Copying the html code in Firefox “No Style” view

15 views
Skip to first unread message

eumgene

unread,
Apr 12, 2014, 3:49:32 AM4/12/14
to fir...@googlegroups.com
Hello,

I asked this on stackoverflow today but suspect that this may be the best place to get an answer. Here is the question:

Some webpages get "better" when "No Style" is chosen in Firefox, View>Page Style>No Style: e.g. the text quickly reflows. I need to save webpages precisely the way they are rendered with the "no style" view is that possible? Can one copy the Firefox-transformed html code behind the "no style" view?

If that was  possible at all, it would be with Firebug I suppose (altough I am a complete newbie)...

Sebastian Zartner

unread,
Apr 12, 2014, 6:38:27 AM4/12/14
to fir...@googlegroups.com
To remove all style sheets from the page you can call this from within the Command Editor:

function removeInlineStyles(node) {
    if (node.hasAttribute("style"))
        node.removeAttribute("style");

    for (var i = 0; i < node.children.length; i++)
        removeInlineStyles(node.children[i]);
}

var styleSheets = document.querySelectorAll("style, link[type='text/css']");
for (var i = styleSheets.length - 1; i >= 0; i--)
    styleSheets[i].parentNode.removeChild(styleSheets[i]);

removeInlineStyles(document.documentElement);


Then you can copy the HTML by right-clicking the <html> element within the HTML panel and choosing Copy HTML.

I added a more detailed description at stackoverflow.

Sebastian
Reply all
Reply to author
Forward
0 new messages