Created
December 13, 2016 05:08
-
-
Save phenomnomnominal/1cfca891b46a006c9cb9855eb587c54c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oldCreateElement = document.createElement; | |
document.createElement = function () { | |
var tagName = arguments[0]; | |
var element = oldCreateElement.apply(document, arguments); | |
if (tagName === 'script') { | |
element.setAttribute('defer', ''); | |
} | |
return element; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basic idea is to have
defer
automatically added to any script tags added after initial page load (read ads)?Stupid? Probably? But does it work?