赛派号

清润型和清爽型区别 "noCache", How to force user page to refresh in order to load my updated changes?

This forum is read only and just serves as an archive. If you he any questions, please post them on github.com/phoboslab/impact

1 decade ago by SlotGamer I he an issue where I update my server but I he to manually delete my browser cache in order to see my new changes. Is there a way to make this automatic? I see a "noCache" variable that looks to be what I should set somehow? I tried adding "?noCache=true" as a suffix to the web page just to test but that didn't seem to work. Could someone please point me in the right direction on how to do this automatically for the user? Thanks 1 decade ago by Joncom One trick, if you can use something like PHP, is to add a timestamp to the URL of whatever you load. For example, url/image.png?time=1 is not the same thing as url/image.png?time=2 and the browser will reload the image each time so long as the value of time changes. 1 decade ago by SlotGamer It looks like Impact adds a current time suffix when it loads. For example: this.data.src = window.ig.prefix + this.path + window.ig.nocache; Isn't this code supposed to trick the browser into grabbing new content from the server similar to how you describe? 1 decade ago by dominic If you append ?nocache to your game&039;s URL the #ig.nocache variable will be automatically set to a random string. E.g.: http://example.com/impact-game/?nocache 1 decade ago by SlotGamer Thanks Guys, So, if I understand correctly, this is what I need to do: For example, the user goes to: http://example.com/impact-game Then on the server in PHP, I redirect them to http://example.com/impact-game/?nocache Would this be the correct way? Will this also load the non-cached version of the game.min.js file? 1 decade ago by cubiq you could do that directly from the Apache server. Add an .htaccess file to your game root and put the following inside: FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" you need the headers apache module of course. you can add any kind of file type to the list (png, jpg, ...) but that would impact bandwidth quite a bit. 1 decade ago by SlotGamer I'm thinking it might be a good idea to combine cubiq's solution with the nocache postfix. I would add an .htaccess file in order to force load the .html, .js, .css. This would make sure the user got the latest version of the code every time. And code is pretty fast to download. Then, inside the code, I set "nocache" to my game's internal version number. This will force a reload of content only the first time. Every time the code's version number changes, it will force a fresh load of all the content again. So, basically every time there is new content, I will upload a new .js with a new version number. Does this sound reasonable? Maybe this is something that should be added to the engine. Page 1 of 1 « first « previous next › last »

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了