Browsers won't reflect changes made in html file

39,073

Solution 1

You can try out the following

  1. Clear the cache of the browser.
  2. Do a clean build of the Webapp

OR

Open the Browser in InCognito or Private Browsing Mode

OR

Try to put a meta tag in your HTML

 <meta http-equiv="pragma" content="no-cache" />

Solution 2

The problem might be due to your Browser caching the HTML Page. This problem may be avoided by -

  • Clearing the Cache of your Browser

  • Try using a false query such as mypage.html?random=6 This method cause the browser to reload he page entirely on a GET request.

  • Use meta tags as below

    <meta http-equiv="pragma" content="no-cache" />
    

    This sometimes is accompanied by another meta in addition as follows

    <meta http-equiv="expires" content="-1" />
    

    It has been observed that sometimes both the above tags are ignored in IE. The suggested workaround is to use the tag twice, i.e. at start as well end of page. This is due to reason because first a 64K buffer is filled by browser on page load. if the buffer is not filled, the "pragma" is simply ignored. Placing this at end of document facilitates no-caching.

Solution 3

If you are using Firefox install the extension called web developer.

Then go to Disable -> Disable Cache -> Disable entire cache.

If you are using Chrome or Chrommium open developer firebug (f12) then go settings (bottom, right) and enable checkbox with text "Disable cache".

In both cases remember to recharge the web page with control+shift+R (various times :P).

And remember to disable this options when you've end your work.

Solution 4

Another trick is to add a false query behind your html tag and force the browser to fetch a new page.

For example:

MySite.html -> MySite.html?q=1, MySite.html?q=2, MySite.html?q=3, and so forth.

As others have mentioned, it seems to be caching is enabled on your host provider.

Share:
39,073
malutan.mircea
Author by

malutan.mircea

Updated on July 09, 2022

Comments

  • malutan.mircea
    malutan.mircea almost 2 years

    I am developing a web site and just ran into a very disturbing problem. My code won't refresh in any browser, meaning not just Internet Explorer but also Google Chrome and Firefox.

    The thing is, in a previous version of the HTML file, I have had a div with a link in it (<a href="">Send request</a>). Today, I have changed that link into a paragraph (<p>Send request<p>).

    When I load my page, it still displays the link. When I commented out the paragraph and reloaded the page, there was no link and my paragraph was checked out. I checked the source file in Chrome and yes, the source file is correct. However, the browser still displays a link that doesn't exist, and deleting the browser history didn't help.

    Any ideas?

    • Lowkase
      Lowkase about 11 years
      Sounds like a caching issue up on the server.
    • bobber205
      bobber205 about 11 years
      Try turning off caching in Chrome.
    • Sebas
      Sebas about 11 years
      what happends if you clear your browser's cache? what you could do is to suffix all your resources by ?time=<?php echo microtime(true); ?> example: <script src="./myscript.js?time=<?php echo microtime(true); ?>"/>
    • xpy
      xpy about 11 years
      Instead of viewing the source code, why don't you just inspect the element with the inspector? ( on chrome, right click -> inspect element ) if you see it, it should be there. And the code you see in the 'source code' is the code that came from the server before any javascript execution
    • user1428716
      user1428716 about 11 years
      possible to put your html on jsfiddle ?
    • user1428716
      user1428716 about 11 years
      @xpy - he is not reading the file from Server - its a local HTML File
    • xpy
      xpy about 11 years
      @user1428716 You're right, but either way it's the same for the browser.
    • malutan.mircea
      malutan.mircea about 11 years
      I've tried inspecting the element and it contains the old link... So inspecting the element reveals the former version of the html while the source shows the current one
    • xpy
      xpy about 11 years
      @malutan.mircea Actually the inspector shows the produced HTML, that means that the element you see is propably added via Javascript, try disabling Javascript temporarily (or comment it out) to see what happens...
  • user1428716
    user1428716 about 11 years
    what does the HTTP Status code for the request say ? HTTP 200 or HTTP 304 ?- Chrome Dev tool -> Network Requests . If its not showing in Incognito something might be problem with the code itself. Any JS Error ?
  • malutan.mircea
    malutan.mircea about 11 years
    Thanks...I installed the plugin and refreshed the page about 20 times using ctrl+shift+r but it still doesn't reflect the latest changes made to the html file...
  • José Cabo
    José Cabo about 11 years
    Have you enabled (disable cache option) what I said in solution?
  • user1428716
    user1428716 about 11 years
    which IDE you are using ? .. if Eclipse -> Server Tab -> Right Click -> Clean ( It will discard all published state)
  • malutan.mircea
    malutan.mircea about 11 years
    Just to be clear i'm writing the website in notepad++. it has not been deployed yet, it is still in the creation process...it's not anythig big. just a simple website with simple functions and some javascript effects..
  • José Cabo
    José Cabo about 11 years
    So the problem is a middleware between browser and server. maybe a cache server inside the server itself or a proxy. Which server are you using?
  • user1428716
    user1428716 about 11 years
    @JoséCabo - He is writing the website in notepad++. :)
  • user1428716
    user1428716 about 11 years
    @malutan.mircea thats not a problem if you fetch HTML from local file
  • José Cabo
    José Cabo about 11 years
    Do you access to your index.html by file://?? If it is true there is no middleware or something caching your code. You haven't disable cache. Did you restart your browsers?