As instruction to upload web desktop version to server, I just need to copy it over, but there is a cache problem, after copy update files to server, browser still keep old version, I have to use private mode to see new changes.
Is there anything I can do to prevent this
so basicly what we do, we having index.php file which including index.html file or we renaming .hmtl file to .php and in side having fllowing code, which get sha of current gamin.min.js and in this case browser will re-download JS file if it is new.
<?php
if (file_exists("cached/game.min.js")) {
chmod("game.min.js", 0777); //changed to add the zero
$sha1 = sha1_file("cached/game.min.js");
$new_file = "cached/game.min-".$sha1.".js";
if (!file_exists($new_file)){
if (copy('cached/game.min.js', "$new_file")){
echo "<script cocos src=\"$new_file\"></script>";
}
else {
echo "<script cocos src=\"cached/game.min.js\"></script>";
}
} else {
echo "<script cocos src=\"$new_file\"></script>";
}
} else {
}
?>
Thank guys, but just this solution for particular file, I can have script updated, image assets udpate, do we have general solution for cocos creator project
Typically we’ll deploy our releases to a dated folder on some static hosting service. Then have our page reference the latest release folder. I can’t think of anyway of keeping the releases in the same folder at all times that would avoid cache hits.
Hi, this is not actually a Creator problem but a common issue with HTML5,JS apps and games (also webpages of course).
Wrap your js and assets folder inside a v01, v02, v03…etc, folder and then djust the urls path in your index.html.
That should fix the problem. For every new version, create a new folder.