Jump to content

how can i reload js or index when game patched?


GBear
 Share

Recommended Posts

hi..

i'm developing 2dmmorpg with html5.+ webgl 

 

how can i reload js or index.html  when code changed?

mobile is always using caching. so i can't reload.   couple a minute i can....

 

do you have tips for this?

 

Link to comment
Share on other sites

You could be talking about 2 different things.

If you want the page to refresh automatically when you save files then use LiveReload. Chrome has an extension for it, otherwise inject a client script and start a livereload server. The livereload server simply emits events when things change (by default it'll watch the file system), the client hears it and reloads the page (or reloads css if it detects that change). There are usually a fair number of parameters.

If you are talking about general cache invalidation, then, there are only two hard things in computer science, although in this case it shouldnt be too hard :)

Putting things into debug or development mode usually invalidate any caches on the client.

If that doesnt work then set Cache-Control headers (there are Expiry headers you can play with too for some use-cases) on your server.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...