Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
window.dynamic_import_javascript = function(url, text, type, frameWindow){
frameWindow = frameWindow || window
var doc = frameWindow.document
var container = frameWindow.document.head || frameWindow.document.body
var newEle = doc.createElement('script')
if (url)
newEle.src = url
if (text)
newEle.appendChild(document.createTextNode(text))
newEle.type = type || 'text/javascript'
container.append(newEle)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment