I'm trying to pass a script into an iframe dynamically so it will run there (content
in the example comes from the server) using this snippet:
content = '<script type="text/javascript">document.write("<a href="http://www.example.com" target="_blank">bla</a>"");</script>';
el = document.getElementById('iframeName');
iframeDoc = el.contentWindow.document;
tempEl = iframeDoc.createElement('div');
tempEl.innerHTML = content;
It runs great on new browsers but when I try to run it on IE8 and lower, the innerHTML comes up null.
I tried different approaches but the inner HTML is the only option i can think of that can run the script i'm passing in to tempEl. Any ideas on how to pass content
into tempEl.innerHTML
so it will run the script and also work on IE8-?