Created
February 1, 2024 21:15
-
-
Save undfine/3ed79e1a239ce0fe69cac64fc40fd9d9 to your computer and use it in GitHub Desktop.
inject external script using JS
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 script = document.createElement('script'); | |
| script.src = 'https://example.com/external-script.js'; | |
| script.async = true; // or script.defer = true; for defer attribute | |
| document.body.appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment