![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
Firefox is not showing the correct page source
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
Solution choisie
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?
Lire cette réponse dans son contexte 👍 0Toutes les réponses (9)
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.
Solution choisie
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?
Modifié le
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.
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.
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)
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.
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.
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.
coatsbob, I recommend changing your chosen solution to jscher2000's second comment rather than his first.