<script id="worker" type="app/worker">
addEventListener('message', function(d) {
console.log(d)
// postMessage('Work done!');
}, false);
function timedCount() {
console.log(this.window);
img.src="http://"+IP+"/favicon.ico?"+new Date().getTime();
self.postMessage(0);
setTimeout("timedCount()",2500);
}
timedCount();
</script>
<script>
(function() {
var blob = new Blob([document.querySelector('#worker').textContent]);
var url = createObjectURL(blob);
var worker = new Worker(url);
worker.addEventListener('message', function(e) {
console.log(e.data);
}, false);
worker.postMessage(window);
})();
</script>