Skip to content

Instantly share code, notes, and snippets.



Last active Sep 19, 2019
What would you like to do?
Detect if a core script failed to load
<script type="text/javascript">
window.addEventListener('error', function(error) {
if ( instanceof HTMLScriptElement) {
const script =;
const isLocalScript = script.src.indexOf( > -1;
if (!isLocalScript) return;
const shouldReload = confirm('a script failed to load properly, try to reload?');
if (shouldReload) location.reload(true);
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment