In the post How to load javascript code to an html fil there is a way to simple load an external js at runtime, and execute. But there is two issues: we don't know when it will be executed and we can't customize the code.
I was using this code:
var elemScript=document.createElement('script');
elemScript.setAttribute('type', 'text/javascript');
elemScript.setAttribute('language', 'javascript');
var txt = document.createTextNode(result);
elemScript.appendChild(txt);
document.head.appendChild(elemScript);
inside of an http request where result is the code provided by a php that make a customized code for me. Above I can dispatch some function that needs the code etc..
But this beauty doesn't work in IE8 or older. Is there a way of make it work or maybe it's time to forget about these old navigators?
Any suggestions?