I could insert online javascript to the current DOM as below,
s = document.createElement('script');
s.src = 'http://url/script.js';
document.appendChild(s);
But Can I preload the script here and customize it a little before it is evaluatied? Is there any javascript could be used to do so?
EDIT: the last line in the above code shoudl be document.getElementsByTagName('head')[0].appendChild(s)
You could use XHR to load it as text, modify it, then isert it as the content of a script element. It will not be executed until it is in the DOM.