Preventing iframe caching in browser

前端 未结 13 1446
自闭症患者
自闭症患者 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条回答
  •  猫巷女王i
    2020-11-29 18:22

    To get the iframe to always load fresh content, add the current Unix timestamp to the end of the GET parameters. The browser then sees it as a 'different' request and will seek new content.

    In Javascript, it might look like:

    frames['my_iframe'].location.href='load_iframe_content.php?group_ID=' + group_ID + '×tamp=' + timestamp;
    

提交回复
热议问题