Iframe src caching issue on firefox

前端 未结 4 811
借酒劲吻你
借酒劲吻你 2021-02-19 06:13

I have an iframe element with a random scr attribute. When I do refresh the page every time, the iframe should load the page with different query parameters based on the src att

4条回答
  •  遥遥无期
    2021-02-19 06:50

    Your code in PHP executes once and sends the content to the browser. When you refresh the page, the code doesn't run again in the server, because it is served by the cache. So the src of the iframe uses the same random number.

    To avoid this you need to disable caching of the original page (not the iframe). Or you could have the random number generated in the client side (using javascript) so that is unique every time.

提交回复
热议问题