搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox is not showing the correct page source

  • 9 个回答
  • 4 人有此问题
  • 87 次查看
  • 最后回复者为 zylstra

more options

I am using Firefox and have noticed that when I do a view page source I do not see the current page, but a cached copy. To view the page source I first have to go to options and delete data.

Here is how to reproduce. 1. Go to a website showing changing data 2. Right click and select view page source 3. Examine the page source to see that it shows an older copy of the data, not the current data 4. Go to options and search on the term 'cache' 5. Delete the cached data 6. Go back to view page source and try again 7. Now the page source is the current data seen in Firefox

I am using Firefox and have noticed that when I do a view page source I do not see the current page, but a cached copy. To view the page source I first have to go to options and delete data. Here is how to reproduce. 1. Go to a website showing changing data 2. Right click and select view page source 3. Examine the page source to see that it shows an older copy of the data, not the current data 4. Go to options and search on the term 'cache' 5. Delete the cached data 6. Go back to view page source and try again 7. Now the page source is the current data seen in Firefox

被采纳的解决方案

After re-reading your question, this may be a different issue depending on why the page content changed:

View Page Source shows the page as it was served. It does not show how that page was modified by scripts after loading. To see the modified source, try this:

  • Select All (Ctrl+A)
  • right-click > View Selection Source

Note that constructing the modified source view can be quite slow for larger pages.

Another way to extract the modified source is via the Page Inspector tool:

  • right-click a blank area of the body > Inspect Element
  • scroll up in the Inspector, right-click the <html ...> tag, click Copy, click Outer HTML

Then you can paste that into your text editor, preferably one that has HTML syntax coloring so it's easier to understand.

Do any of those options work for you?

定位到答案原位置 👍 0

所有回复 (9)

more options

Web browsers will store website data to reduce the amount of the same data being sent over the web.

Type about:preferences#privacy<enter> in the address bar. The button next to History, select Use Custom Settings.

Turn off Always Use Private Browsing Mode Turn on Remember My Browsing And Download History At the bottom of the page, turn on Clear History When Firefox Closes. At the far right, press the Settings button. Turn on ONLY Cache and Form And Search History leaving the others off.

more options

选择的解决方案

After re-reading your question, this may be a different issue depending on why the page content changed:

View Page Source shows the page as it was served. It does not show how that page was modified by scripts after loading. To see the modified source, try this:

  • Select All (Ctrl+A)
  • right-click > View Selection Source

Note that constructing the modified source view can be quite slow for larger pages.

Another way to extract the modified source is via the Page Inspector tool:

  • right-click a blank area of the body > Inspect Element
  • scroll up in the Inspector, right-click the <html ...> tag, click Copy, click Outer HTML

Then you can paste that into your text editor, preferably one that has HTML syntax coloring so it's easier to understand.

Do any of those options work for you?

由jscher2000 - Support Volunteer于修改

more options

It is interesting that the option

    Select All (Ctrl+A)
   right-click > View Selection Source 

worked. Since what is seen is the previous loading of that particular page. Seems odd to me that the starting point or some intermediate form of a page would be the cached version. At least there is a solution.

Much appreciated.

more options

Firefox usually reloads the page from the server and this means that if script that runs on the page modifies the content then you do not get the source of the current version, but possibly the unmodified page you previously had. View Selection Source generates the source page from the current DOM and that includes all changes made in the meantime.

more options

See also:

  • Bug 1318234 - view-source: uses the cached version of a page, not respecting the caching headers from GMail or other sites

(please do not comment in bug reports
https://bugzilla.mozilla.org/page.cgi?id=etiquette.html
)

more options

This issue is not something I ran into recently. It is a change in something I have used for over 5 years. The current issue was introduced within the last 5 days.

I would suspect it is due to a change in the software since the most recent time Firefox was updated on my computer.

This is the first time I have reported a bug - ever.

more options

Actually, I ran into this this afternoon. Reloading the main page should have updated the cache, but the View Source showed the older version. I actually had to reload on the View Source page to update it. Very odd.

more options

Answer: This is a bug in Firefox. You can probably see the current, unmodified-by-scripts source by reloading the View Page Source page itself.

More Detail:

coatsbob said

Seems odd to me that the starting point or some intermediate form of a page would be the cached version. At least there is a solution.

jscher2000's answer is not a solution, because what you are seeing with his method is not the source unmodified by scripts. His method shows you the current, modified-by-scripts source. What you wanted to see but could not (because Firefox has a bug here) is the current, unmodified-by-scripts source.

View Page Source shows you the cached, unmodified source, which is ridiculous. By cached I do not mean the source of the cached web page; I mean the page containing the source that was also cached. This is what you are seeing.

You can see that jscher2000's method shows the following in the address bar when used on example.com:

view-source:data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%0A%20%20%20%20%3Ctitle%3EExample%20Domain%3C%2Ftitle%3E%0A ...

View Page Source shows

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

Edit: I now see that jscher2000 sees the issue, as he stated in his last comment.

more options

coatsbob, I recommend changing your chosen solution to jscher2000's second comment rather than his first.