Skip to content

Instantly share code, notes, and snippets.

@cou929
Created August 2, 2013 12:23
Show Gist options
  • Save cou929/6139492 to your computer and use it in GitHub Desktop.
Save cou929/6139492 to your computer and use it in GitHub Desktop.
sample code to test reloading and caching. http://please-sleep.cou929.nu/super-reload-and-cache.html
<html>
<body onload="onload()">
<img src="http://please-sleep.cou929.nu/images/twitter-48.png?normal"/>
<iframe src="./test.html?noraml"></iframe>
<script src="./test.js?noraml"></script>
<script>
// img
(new Image()).src = 'http://please-sleep.cou929.nu/images/twitter-48.png?dynamic';
// iframe
var iframe = document.createElement('iframe');
iframe.src = './test.html?dynamic';
document.body.appendChild(iframe);
// script
var script = document.createElement('script');
script.src = './test.js?dynamic';
document.body.appendChild(script);
function onload() {
// img
(new Image()).src = 'http://please-sleep.cou929.nu/images/twitter-48.png?onload';
// iframe
var iframe = document.createElement('iframe');
iframe.src = './test.html?onlaod';
document.body.appendChild(iframe);
// script
var script = document.createElement('script');
script.src = './test.js?onload';
document.body.appendChild(script);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment