Making a web page cache even if the parameters change

前提是你 提交于 2021-01-05 11:32:06

问题


Is there a way to get a browser to cache a web page even if the parameters change?

I have a web assembly app that takes parameters. If the parameters change, the browser forces a download. Is there any way I can set headers so that the parameters aren't a factor in caching?

i.e. if I do

http://www.example.com?param=1234

and

http//:www.example.com?param=4321

...the browser thinks it's a whole new site and downloads the whole 26mb web assembly binary again.

Anything I can do?


回答1:


You can use the Cache-Control header:

<?php

header("Cache-Control: public, max-age=604800, immutable");


来源:https://stackoverflow.com/questions/63706770/making-a-web-page-cache-even-if-the-parameters-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!