[Greasemonkey] Blocking GreaseMonkey script

Alf Eaton lists at hubmed.org
Thu Mar 23 22:44:46 EST 2006


On 14 Mar 2006, at 00:43, Jeremy Dunck wrote:

> On 3/13/06, vaesel at poczta.onet.pl <vaesel at poczta.onet.pl> wrote:
>> Hello everybody.
>>
>> I'd like to know if there's any effective way to prevent Greasemonkey
>> user scripts from executing???
>
> As a site owner?  Intentially not.  There used to be a way:
> http://dean.edwards.name/weblog/2005/03/ungreased/

There does seem to be a way to stop Greasemonkey from working, as I  
found out by accident (see this thread: <http://mozdev.org/pipermail/ 
greasemonkey/2006-March/007977.html>).

If you serve your pages to Firefox as application/xhtml+xml, save the  
following as a file called block.xsl in the root of your site:

<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/ 
Transform'>
	<xsl:template match="*">
		<xsl:copy-of select="."/>
	</xsl:template>
</xsl:stylesheet>

and put
<?xml-stylesheet type="text/xsl" href="block.xsl"?>
at the top of your pages (just before the DOCTYPE), then Greasemonkey  
won't be able to run.

Of course, this relies on your pages being valid XML, otherwise they  
won't display at all :-)

alf.


More information about the Greasemonkey mailing list