Page 1 of 1
NoScript breaks view-source:
Posted: Sat Nov 19, 2011 2:55 pm
by mauke
Recently I noticed that a few of my bookmarklets don't work right anymore because data from view-source: urls isn't displayed. The only mention of this I can find is "v 2.1.2.7rc1 + Prevent any website from embedding view-source URIs inside frames" in the changelog. I couldn't find any documentation on why this was done or a pref to disable this behavior.
So my question is: How do I fix NoScript to make my bookmarklets work again?
Re: NoScript breaks view-source:
Posted: Sun Nov 20, 2011 1:59 pm
by therube
Could you post the bookmarklets in question?
Re: NoScript breaks view-source:
Posted: Mon Nov 21, 2011 10:46 am
by mauke
Here's one:
Code: Select all
javascript:s=document.getElementsByTagName('SCRIPT'); d=window.open().document; d.open();d.close(); b=d.body; function trim(s){return s.replace(/^\s*\n/, '').replace(/\s*$/, ''); } function add(h){b.appendChild(h);} function makeTag(t){return d.createElement(t);} function makeText(tag,text){t=makeTag(tag);t.appendChild(d.createTextNode(text)); return t;} add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;}')); add(makeText('h3', d.title='Scripts in ' + location.href)); for(i=0; i<s.length; ++i) { if (s[i].src) { add(makeText('h4','script src="' + s[i].src + '"')); iframe=makeTag('iframe'); iframe.src='view-source:'+s[i].src; add(iframe); } else { add(makeText('h4','Inline script')); add(makeText('pre', trim(s[i].innerHTML))); } } void 0
Re: NoScript breaks view-source:
Posted: Mon Nov 21, 2011 3:20 pm
by Giorgio Maone
Reason is
#1 here.
There's no setting to restore the original behavior and allow framed view-source docs (which, BBTW, are supported by Firefox only), but as a work-around you could open your view-source in a top-level window.