Is the HTML shown via 'View Source' different from the HTML shown in (Firebug) developer tools?

时光毁灭记忆、已成空白 提交于 2019-11-26 12:25:22

问题


I\'m using Firefox alongside Firebug Developer tools.

Is the HTML shown in View Source (Ctrl + U) different from the HTML I see when inspecting elements using Firebug?

What are the differences between the two?


回答1:


Yes they are different.

View source shows you the original HTML source of the page.

The inspector shows you the DOM as it was interpreted by the browser. This includes for example changes made by javascript which cannot be seen in the HTML source.

Oh and this also counts for the developer tools that allow you to view the DOM in other browsers, like the Chrome Web Inspector and Internet Explorer Developer Toolbar. The HTML source will always be the same across all browsers, the generated DOM might differ as it is an interpretation and render engines are not all the same (unfortunately).




回答2:


It should also be noted that aside from the dynamic DOM manipulation which could be occurring via javascript etc, Firefox will also parse and "clean-up" malformed (X)HTML, so these changes will also affect what you see when inspecting an element.




回答3:


The difference are (but not limited to) that in firebug console you can see dynamically changes, which occurred in web page. For example, DOM elements modifications (from AJAX or regular JavaScript), CSS in-place modifications, etc...




回答4:


In Firefox, View Source may reload the page, changing what is on it. See this bug and vote for it if it is bothering you:

https://bugzilla.mozilla.org/show_bug.cgi?id=307089



来源:https://stackoverflow.com/questions/13070190/is-the-html-shown-via-view-source-different-from-the-html-shown-in-firebug-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!