Created
June 17, 2020 13:31
-
-
Save pavelbinar/b5c4812bff1db02704f1b9cd212c8f0c to your computer and use it in GitHub Desktop.
Dynamically add script tag with unique src
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
<script> | |
var now = new Date().getTime(); | |
var newScript = document.createElement("script"); | |
newScript.src = "<%= htmlWebpackPlugin.options.mainURL %>?t=" + now; | |
var target = document.getElementsByTagName("body")[0]; | |
target.appendChild(newScript); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment