javascript - autoreload webpage on new release -


i have website in php ajax-based. there index.php, part it, other pages never rendered directly browser. instead, post , requests done javascript through ajax. basically, if go /contact.php not see anything. pages rendered inside index.php.

there lot of people use page not web-savvy , may not understand means when ask them refresh page.

the biggest issue happens when new release. javascript code (but not only) can old 1 in client's webpage maybe haven't refreshed page weeks.

i perform svn update publish new code server. refresh page , see new features.

however, people don't know how refresh not see anything. have added big button on page text "refresh", executes location.reload. may people, not everyone.

how can "force" browser reload when new version has been published? prefer simple not require additional libraries or timer.

it quite important page not refresh when user doing page, may lose work when happens.

i think can add version constant in code

 <?php   define(version, '1.0'); 

and everytime call javascript add extension

 <script type="text/javascript" src="myfile.js?<?php echo version ?>"> 

so when you'll update version, every js recalled navigator. more clear?

you can add version check web service called before validate action, can refresh page or warn user before doing action.

without timer or socket.io can't refresh page user.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -