Skip to content

Instantly share code, notes, and snippets.

@danlangford
Created February 6, 2012 20:14
Show Gist options
  • Save danlangford/1754537 to your computer and use it in GitHub Desktop.
Save danlangford/1754537 to your computer and use it in GitHub Desktop.
see if somefile has changed their predefined timestamp
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script src="https://raw.github.com/jgallen23/cookie-monster/master/dist/monster.js"></script>
</head>
<body>
</body>
<script>
function say(msg) {
$('body').append('<p>'+msg+'</p>');
}
function checkVersion(newVersion) {
var oldVersion = monster.get('VERSION');
if (oldVersion === newVersion) {
say('SAME! you should check for version change in 10 min');
say('now open your DEV tools, change or kill the Cookie, and reload this page');
} else {
monster.set('VERSION',newVersion);
say('DIFFERENT! Refresh the page');
say('in JS you can do a window.location.reload()');
say('now reload the page manually and see if its the same');
}
}
$(function(){
$.get('somefile.php',function(response, status){
checkVersion(response.split('html')[0]);
})
});
</script>
</html>
<!-- 2012-01-24 09:41:22 -->
<!DOCTYPE html>
<html>
<head>
</head>
<body>
this is not really a php file, just used for testing
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment