I wrote the simple script (see bottom of this posting) into a file
D:\tmp\myscript.script
and dragged this file on my Firefox (Greasemonkey addon is installed and enabled).
After dragging the following URL is visible in the browser:
file:///D:/tmp/myscript.script
But after hitting RETURN the script does not run.
Why?
Do all scripts have to be on a server and accessible only through http:// protocol - no file:/// possible?
Ben
// ==UserScript==
// @name Test
// @namespace Foo
// @description Test
// @include *CFIDE/debug/blank.html*
// @version 0.0.1
// ==/UserScript==
var x = document.createElement("<iframe>");
x.src = "http://www.google.com";
document.body.appendChild(x);
var x = document.createElement("<iframe>");
x.src = "http://www.yahoo.com";
document.body.appendChild(x);
var x = document.createElement("<iframe>");
x.src = "http://www.bing.com";
document.body.appendChild(x);
--
cc | pseudonymous |<http://carlclark.mp/>
Since a couple of releases there are two new 'hidden' preferences:
greasemonkey.aboutIsGreaseable
greasemonkey.fileIsGreaseable
The default value is "false". If you want Greasemonkey to run on
file:/// urls, you have to set the second one to "true" (in
about:config).
I only run script I've written, but it you run outside script, there is a security issue with changing these settings.
; document.body.appendChild(x); -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to greasemon...@googlegroups.com. To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
1) In order to *install* a userscript, the file must have the .user.js
extension, regardless of whether the file is a local one or if it is
retrieved via http from some server.
2) In order for the script to *run*, you have to visit some page whose
url matches some of the @include lines in the script header. In your
case, there is just one @include line, namely
@include *CFIDE/debug/blank.html*
This means you have to (install the script and afterwards) visit some
page whose url is something like this:
http://foo.someserver.com/bar/bazCFIDE/debug/blank.html
3) The preferences settings have nothing to do with the above. They
are necessary when you want a script to run upon visiting locally
stored html pages, in other words, when the associated url is of the
form file:///* instead of http://*
I strongly suggest you take a look a the Greasemonkey wiki for further
information about basic features of the extension:
http://wiki.greasespot.net/Main_Page