Can Firefox's “view source” be set to not make a new GET request?

前端 未结 12 1468
你的背包
你的背包 2020-12-13 05:50

This is sort of tangential to coding, but programmers often do \"view source\" on their own pages and on others\' pages. I learned that when you do the normal View Source in

相关标签:
12条回答
  • 2020-12-13 06:24

    This is an older question but it still happens from time to time depending on what they have currently broken in the latest Firefox or what subtle extension bug is causing conflicts.

    I wanted to post a workaround that seems to work for me consistently, because in the end we have to get work done and not spend hours trying to fix this.

    Simply add view-source: to the beginning of the url and it will show the source with the get/post data that you are trying to use.

    ie.

    view-source:http://stackoverflow.com/

    Not a true solution but a work-around to get work done.

    0 讨论(0)
  • 2020-12-13 06:24

    Open the dev console (with F12, "Inspect Element" in the right-click menu, etc.) and navigate to the Inspector tab. Right click anywhere in the panel showing the DOM tree and click "Expand All". Scroll to the very top of the DOM tree and right-click the <html> tag. Click "Edit as HTML" and the entire DOM tree should appear in an editable text box. This should now be selectable with Ctrl+A. Copy and paste into the destination of your choice.

    Bear in mind that if the source itself contains URLs, e.g. imports styles from a CDN, that means your copy of the page still won't load independently and will look different if you can't access those assets. It'll be an exact copy of the page's original logic, plus your changes.

    0 讨论(0)
  • 2020-12-13 06:27

    If you install the web developer toolbar extension, there's an option under "View Source" called "View Generated Source" which will show you the current source of the page, including any DOM changes you may have made.

    0 讨论(0)
  • 2020-12-13 06:27

    You can just set Firefox into Offline mode before issuing View Source command. It will not (be able to ) get a fresh page source.

    0 讨论(0)
  • 2020-12-13 06:27

    From Firefox 42.0 onwards, clicking "View source" should not do a new GET request but use the cache:

    Importantly, we have also ensured that View Page Source provides you with the source of the page as-is from Firefox’s cache – we do not fetch a new version.

    Reference: https://hacks.mozilla.org/2015/07/developer-edition-41-view-source-in-a-tab-screenshot-elements-har-files-and-more/

    0 讨论(0)
  • 2020-12-13 06:28

    Use the FireBug extension. It displays (and allows you to navigate) only the rendered source, so there is no need for another request (and it shows Javascript changes).

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