f



Nixing Javascript via javascript: pseudoproto?


This is a question about defensive web browsing.  Ocassionally I
run into a page whose JavaScript does something that I find obnoxious.
I would like to turn off JavaScript only for that page (instead of
disabling it globally).  It would be cool if there were some way
to do this through a "bookmarkable" JavaScript snippet using the
javascript: pseudoprotocol.  Does anyone know any trick to do any
of this?

Many thanks!

	-bill


0
bill
7/7/2004 8:13:54 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

2 Replies
883 Views

Similar Articles

[PageSpeed] 59

"bill" wrote
> This is a question about defensive web browsing.  Ocassionally I
> run into a page whose JavaScript does something that I find obnoxious.
> I would like to turn off JavaScript only for that page (instead of
> disabling it globally).  It would be cool if there were some way
> to do this through a "bookmarkable" JavaScript snippet using the
> javascript: pseudoprotocol.  Does anyone know any trick to do any
> of this?

The following bookmarklet code removes all scripts and all event
definitions, then reloads the cleaned up page:

javascript:if(frames.length){alert('Sorry, doesn\'t work in
frames');}else{onerror=function(){return
true};while((es=document.getElementsByTagName('script')).length){es[0].paren
tNode.removeChild(es[0]);}es=document.all;for(i=0;i<es.length;++i){e=es[i];f
or(p in
e){if(!p.indexOf('on')&&e[p]){e[p]=null;}}}document.write(document.documentE
lement.outerHTML);document.close();onerror=function(){return true};}void 0;

HTH
Ivo


0
Ivo
7/7/2004 8:23:21 PM
In <40ec5ed8$0$144$18b6e80@news.wanadoo.nl> "Ivo" <no@thank.you> writes:

>"bill" wrote
>> This is a question about defensive web browsing.  Ocassionally I
>> run into a page whose JavaScript does something that I find obnoxious.
>> I would like to turn off JavaScript only for that page (instead of
>> disabling it globally).  It would be cool if there were some way
>> to do this through a "bookmarkable" JavaScript snippet using the
>> javascript: pseudoprotocol.  Does anyone know any trick to do any
>> of this?

>The following bookmarklet code removes all scripts and all event
>definitions, then reloads the cleaned up page:

>javascript:if(frames.length){alert('Sorry, doesn\'t work in
>frames');}else{onerror=function(){return
>true};while((es=document.getElementsByTagName('script')).length){es[0].paren
>tNode.removeChild(es[0]);}es=document.all;for(i=0;i<es.length;++i){e=es[i];f
>or(p in
>e){if(!p.indexOf('on')&&e[p]){e[p]=null;}}}document.write(document.documentE
>lement.outerHTML);document.close();onerror=function(){return true};}void 0;

Way cool!  Very handy.

Thanks!

	-bill
0
bill
7/8/2004 11:37:06 AM
Reply: