Run Greasemonkey on Local Pages

2724 views
Skip to first unread message

Matt Sargent

unread,
Dec 29, 2009, 7:00:46 PM12/29/09
to greasemon...@googlegroups.com
Until a recent release, Greasemonkey could run on locally stored HTML
pages. This was very handy, especially when combined with the Scrapbook
add-on. Does anyone know of a way to restore this behavior to a script?

cc

unread,
Dec 29, 2009, 8:02:54 PM12/29/09
to greasemon...@googlegroups.com, Matt Sargent
Well, I sort of cheat: I run Apache on my (Windows) machine and serve
certain pages from there. It works pretty well for this and other
things, although Apache's configuration could be more intuitive. I've
heard good things of lighttpd, also, but have never tried it. And of
course there are lots of other web servers you could use, IIS among them.

I originally did this because I needed to prototype a website, but I've
found it useful for lots of other things as well (like GM scripts).

--
cc | pseudonymous |<http://carlclark.mp/>


esquifit

unread,
Dec 29, 2009, 8:06:29 PM12/29/09
to greasemon...@googlegroups.com
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).

Kwah

unread,
Dec 29, 2009, 8:46:35 PM12/29/09
to greasemon...@googlegroups.com
2009/12/30 cc <carl...@lavabit.com>:

> Well, I sort of cheat: I run Apache on my (Windows) machine and serve
> certain pages from there. It works pretty well for this and other
> things, although Apache's configuration could be more intuitive. I've
> heard good things of lighttpd, also, but have never tried it. And of
> course there are lots of other web servers you could use, IIS among them.
>

As a small aside, I strongly recommend taking a look at WAMP [1] and XAMPP [2].

They aren't recommended for public-facing sites because they are very
open and very insecure when used 'out of the box' but it is very
useful as a local testing server (exactly as it is intended to be
used).


[1] WAMP - Windows, Apache, MySql & PHP - http://www.wampserver.com/en/
[2] XAMPP - Cross (X) platform Apache, MySql, PHP & Perl -
http://www.apachefriends.org/en/xampp.html

Matt Sargent

unread,
Jan 1, 2010, 1:49:26 AM1/1/10
to greasemon...@googlegroups.com
THANK YOU!! This was exactly what I was looking for. It works perfectly.

esquifit

unread,
Jan 1, 2010, 5:39:17 AM1/1/10
to greasemon...@googlegroups.com
Glad to know. Keep in mind, however, that this implies a security
risk. A malicious userscript could open a tab or a frame, load a
"file:" url from your local drive into it, read the contents and send
them to any server. Even binary files could be stolen in this way,
including files stored in your Firefox profile containing sensitive
information (passwords, cookies, history, etc). In order to know the
exact location of the profile folder the attacker could either do a
recursive scan of your hard disk (directory contents can also be
listed via file: urls) until it reached the profile.ini file in which
all profile directories are listed, or it could open the about:cache
page and read the profile from there, provided access to about: urls
is granted via the "greasemonkey.aboutIsGreaseable" preference. This
security risk was in fact the motivation for the new preferences, as
far as I can remember. This was handled in bug #1000:

http://github.com/greasemonkey/greasemonkey/issues/closed#issue/1000

Reply all
Reply to author
Forward
0 new messages