<script> | |
'use strict'; | |
var link = document.createElement('link'); | |
link.setAttribute('rel', 'serviceworker'); | |
link.setAttribute('href', 'empty-worker.js'); | |
function report(result) { | |
top.postMessage({id: location.search, result: result}, '*'); | |
}; | |
link.onload = function() { | |
report('loaded'); | |
}; | |
link.onerror = function() { | |
report('error'); | |
}; | |
document.getElementsByTagName('head')[0].appendChild(link); | |
</script> |