I am running this code at some point of my site:
function test(){
var script = document.createElement("script");
script.src = "https://my_script.js";
script.type="text/javascript";
script.charset="UTF-8";
document.getElementById("testing").appendChild(script);
}
It runs well the first time, but then I would like to remove all the code the .js injected and re-run again my function, but this time changing the url source, but I get the following warning and does nothing:
@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning.
It's just a local webpage with normal html and javascript.
Can anyone tell me what can I do, or if what I want to do is ok or should I not be doing that.
Thanks!