开发者

Caching problem with .htm on MVC3 view.

I have a view that loads external HTML into an iframe. I don't know if the iframe is compounding the issue, but even when the content of the file that the iframe loads has long been replaced with a newer, working content, Chrome still loads the ghost of the older, broken HTML file into the iframe. Fortunately my files are named with GUID's, so I could fix this problem by simply renaming the file, but I would like to get to the bottom of this. I am using the build in web server, not IIS.

MY EXCUSE FOR IFRAMES: My admin end user will be uploading HTML published from Excel, along with all it's gory styling. Wr开发者_如何学Pythoniting import code is way to complex at this stage.


Rather than renaming the file what I usually do is append a querystring to all static data on my page with some kind of key generated on the server side.

This way you can ensure your JS, CSS, HTML and any other static content types are re-loaded when you change them.

Another thing you can do is have the iframe point to something that acts as a proxy for the static page and returns it. Probably a bit overkill for what you're trying to do and my preference would be the querystring method.

As for getting to the bottom of the problem, there are so commonly known caching issues with iframes, one of them being the caching of the actual url (hence the second option above).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜