Here is a question I've yet to find an answer to.
I have some javascript I'd like to be dynamically inserted into a page when its called. The set up is this.
I have an <iframe> in my site and the pages that get linked to externally to go into the iframe obviously dont change the size of the iframe without a little help. The idea behind it is this.
I can resize the <iframe> based on the page that is being framed providing I put a tiny chunk of code in it. Thats not possible if I dont own the pages so the <iframe> will just add scroll bars which is very unattractive.
I'd like to take this script below and have it inserted into every EXTERNAL page I frame dynamically. In fact even a link to a .js would work.
<script type="text/javascript">
function goSetHeight() {
if (parent == window) return;
// no way to obtain id of iframe object doc loaded into? no parentNode or parentElement or ...
else parent.setIframeHeight('ifrm');
}
</script>
So for instance if I took my web site and put an iframe in it with Daniweb.com as the page, I'd like this code to somehow be an addendum or part of the final render of daniweb.com for instance.
Is this insane or what?
Jared