Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active February 16, 2018 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/f45d8ba9c9af356f7564ca5d27e6d50f to your computer and use it in GitHub Desktop.
Save nolanlawson/f45d8ba9c9af356f7564ca5d27e6d50f to your computer and use it in GitHub Desktop.
Resource with unrecognized type
display.innerText += 'Script downloaded and executed!\n'
<html>
<head><title>Resource with unrecognized type</title></head>
<body>
<h1>Resource with unrecognized type</h1>
<p>Related: <a href='https://bugzilla.mozilla.org/show_bug.cgi?id=838521'>https://bugzilla.mozilla.org/show_bug.cgi?id=838521</a></p>
<pre id="display"></pre>
</body>
<script type="application/completely_fake_mime_type" src="file.js"></script>
<script>
intervalId = setInterval(function () {
var downloaded = performance.getEntriesByType('resource').some(function (resource) {
return resource.name.match(/file.js$/)
})
if (downloaded) {
display.textContent += 'Resource was downloaded!\n'
clearInterval(intervalId)
}
}, 1000)
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment