Is “Page Source” BEFORE or AFTER JavaScript has been rendered?

前端 未结 4 1170
逝去的感伤
逝去的感伤 2020-12-18 20:26

In Firefox there is a menu item that displays \"Page Source\": View | Page Source (Ctrl+U). In Internet Explorer there is a similar function.

When you invoke it, it

相关标签:
4条回答
  • 2020-12-18 21:17

    The "View Source" code is the code before any JavaScript is applied.

    Firefox's Web Dev toolbar will allow you to view the resulting post-JavaScript source code from the View Source > View Generated Source menu option.

    0 讨论(0)
  • 2020-12-18 21:17

    Before. The page source is the result of the GET request by the browser sans headers. If you want to view the updated content after scripts and so forth, you'll have to use a tool like Firebug or the Web Development toolbar.

    0 讨论(0)
  • 2020-12-18 21:23

    It is the source that was returned to the browser by the server, before DOM updates made through javascript.

    0 讨论(0)
  • 2020-12-18 21:25

    Unfortunately, it will always display the HTML as the page was before DOM-change by javascript, etc. So the answer is: what you are seeing is "raw as received by HTTP GET".

    You can use a tool like Firebug (Firefox & Chrome) to see live dom changes. Or you can make your own function to display the live dom.

    0 讨论(0)
提交回复
热议问题