Since Greasemonkey can not read / write files from a local hard disk, I've heard people suggesting Google Gears , But I use FileSystemObject to write this test file / file, ' file: /// c: /test.js
is a javascript file from the local hard disk, so probably be able to read / write files on my local hard disk
I tried it but Firefox stopped the file: /// c: /test.js
script to read / write files from local disk. (
Is there any setting in Firefox about : config
, where we can specify to give a special script, from local file or XIs dot com, but My local disk files to allow reading / writing?
You can use these chrome radius.
var file manager = {write: function (file, text) {if (! File) returns; Constant Unicode Converter = Component. Class ["mozilla.org / intelli / skitable unicode converter"] .createInstance (Components.interfaces.nsIScriptableUnicodeConverter); Unicode Converter. Charset = "UTF-8"; Text = unicode controller. ConvertformInnnod (text); Const OS = Component Classes ["@mozilogg/networkworks/file-output-stream; 1"] .cent instance (Components interface. OSITI file overtaste); OSITIT (file, 0x02 | 0x08 | 0x20, 0700, 0); Write dew (text, text. Length); Osklos ();}, read: function (file) {if (! File) return; Var Ras; Const = Component Class ["@mozilla.org/network/file-input -stream; 1"] .createInstance (Components.interfaces.nsIFileInputStream); Const sis = Components.classes ["@ mozilla.org/scriptableinputstream;1"] .createInstance (Components.interfaces.nsIScriptableInputStream); Is.init (file, 0x01, 0400, zero); Sis.init (is); Res = sis.read (sis.available ()); is close(); Return ridge; },}
Example:
var x = FileManager.Read ("C: \\ test.js");
Comments
Post a Comment