asp.netbrowser-cachehtml-frames

Browser cache HTML frame content


I have a HTML frame on my ASP.NET page which pionts to a static HTML file.

The problem is if I change the HTML (frame contetnt) browser still shows the previous version. Even CTRL+F5 doesn't update the browser cache.

I should paste the HTML page address in bowser and press CTRL+F5 and see the new version, then if I visit the ASP.NET page, the new contetnt would be shown in the frame.

How can I fix this?


Solution

  • CTRL+F5 is reloading the current page not the frame.

    In firefox you have to right click the frame > This Frame > Reload. That does the the trick, I assume IE has a similar option.

    Another option is to add the following headers to the content of the FRAME

    <meta http-Equiv="Cache-Control" Content="no-cache">
    <meta http-Equiv="Pragma" Content="no-cache">
    <meta http-Equiv="Expires" Content="0">
    

    This should force the browser to not cache.

    I believe (And it's a while ago since this was done) IE6 ignored the above headers and if the frame content is dynamic a hack/work around was to append a random number to the URL when loading the frame content.