On Fri, May 21, 2010 at 2:09 PM, jyothi panidarapu <[email protected]> wrote: > Can somebody give me a script, which opens a local file (the contents of the > local file will be either 0 or 1) for reading. If it is '1' the current page > should be reloaded otherwise do nothing. The script should keep checking > the file for update. >
A couple of observations: 1) GM_getResourceText won't work, since this function loads a resource only once upon installing the scripts and stores a local copy into "<Firefox profile>/gm_scripts/<script folder>/". If the original file is updated afterwards, this is not noticed by Greasemonkey. 2) You can open a new tab with the "file" schema (file:///path/to/your/file.txt)by means of GM_openInTab() [1], provided you set the value of the preference "greasemonkey.fileIsGreaseable" to "true" in about:config. One problem with this approach is that a new tab is created each time, it is (currently) not possible to either close the tab or reloaded. Another problem is that this poses a risk if you don't know what you're doing (malicious script could steal information from your computer) 3) Regardless of all that I suspect there are better ways to achieve what you're attempting to do. Maybe you want to supply more details, for example whether you have some control over the file contents, or whether a file is really needed. [1] http://wiki.greasespot.net/GM_openInTab -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
