Preventing iframe caching in browser

前端 未结 13 1431
自闭症患者
自闭症患者 2020-11-29 18:03

How do you prevent Firefox and Safari from caching iframe content?

I have a simple webpage with an iframe to a page on a different site. Both the outer page and the

13条回答
  •  执念已碎
    2020-11-29 18:34

    I found this problem in the latest Chrome as well as the latest Safari on the Mac OS X as of Mar 17, 2016. None of the fixes above worked for me, including assigning src to empty and then back to some site, or adding in some randomly-named "name" parameter, or adding in a random number on the end of the URL after the hash, or assigning the content window href to the src after assigning the src.

    In my case, it was because I was using Javascript to update the IFRAME, and only switching the hash in the URL.

    The workaround in my case was that I created an interim URL that had a 0 second meta redirect to that other page. It happens so fast that I hardly notice the screen flash. Plus, I made the background color of the interim page the same as the other page, and so you notice it even less.

提交回复
热议问题