如何查看“生成的HTML代码”在Firefox? [英] How to view "generated HTML code" in Firefox?
问题描述
如果使用Firebug,我们可以点击HTML标签,然后点击展开每个元素来查看生成的HTML代码。有没有办法扩展全部或获得纯文本文件?
我只是不小心发现,甚至不需要是萤火虫。我们可以在网页上按CTRL-A(全选),然后右键单击并选择查看选择源,然后我们将得到一个当前HTML代码的纯文本文件,甚至会看到一个<$如果Firebug处于打开状态,那么它就是在< body>
标记之前的Firebug面板。但它似乎是一个奇怪的方式来调用这个。有什么其他的办法吗?
$ b 更新:生成的HTML通常是指JavaScript改变DOM后的HTML,它是当前的DOM树而不是原始源代码)在Firebug的HTML选项卡中,右键单击根节点并选择复制HTML。然后粘贴到文本编辑器中。
如果没有Firefox附加组件,您可以使用 bookmarklet 像这样:
javascript:var win = window.open(); < pre> + document.documentElement.innerHTML< / head>< html>< head>< title>< + location.href +'< / title> (/&< / g,'& lt;')+'< / pre>< / html>'); win.document.close(); void 0;
If using Firebug, we can click on the HTML tab, and click to expand each element to see the generated HTML code. Is there a way to expand it all or get a plain text file?
I just accidentally found out that there doesn't even need to be Firebug. We can just press CTRL-A (to select all) on the webpage, and then right click and choose "View Selection Source", then we will get a plain text file of the "current HTML code", even will see a <div>
that is the Firebug panel that is before the <body>
tag if Firebug is open. But it seems like a weird way to invoke this. Is there any other way?
(Update: generated HTML usually refers to the HTML after JavaScript changes the DOM. It is the current DOM tree instead of the original source code)
In Firebug's HTML tab, right-click the root node and select "copy HTML". Then paste to a text editor.
Without Firefox Add-Ons, you could use a bookmarklet like this:
javascript: var win = window.open(); win.document.write('<html><head><title>Generated HTML of ' + location.href + '</title></head><pre>' + document.documentElement.innerHTML.replace(/&/g, '&').replace(/</g, '<') + '</pre></html>'); win.document.close(); void 0;
这篇关于如何查看“生成的HTML代码”在Firefox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!