From Paste code into page context using content script
var s = document.createElement('script');
s.src = chrome.extension.getURL('script.js');
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head||document.documentElement).appendChild(s);
I read all the topics in Stack ... and the documentation from Google regarding the Google Chrome and script extensions, but I don't understand the purpose of line 5 in the above injection script code:
this.parentNode.removeChild(this);
I may need some JavaScript training, I know, but what happens if you don't delete the script after executing it? Will the expansion crash? Is it just for pure coding or has a specific purpose?
kawa source
share