Link to home
Start Free TrialLog in
Avatar of madmare
madmareFlag for Israel

asked on

set iFrame title for the page

Hello Experts,
 How do I in my following page, get the iframe title to be the page title

 how do I can do it by the Setup function ?

Thanks
<html><head><title></title>
<script type="text/javascript">
    function setup() {
        var ifrms = parent.document.getElementsByTagName("aa");
        
        if (ifrms.length > 0) { // We're embedded
            parent.document.title = "example";
        } else {
            document.body.innerHtml = "Content";
        }
    }
</script>
</head><body onLoad="setup();">
<iframe id = "aa" name = "aa" src='http://www.cnn.com' > </iframe> 
</body></html>

Open in new window

Avatar of dmeeren
dmeeren
Flag of Netherlands image

This cannot be done in HTML, you could do a curl in php and get the page title and put it between the title tags.
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
document.write('<iframe src="http://www.yourwebsite.com/home.html?title='+document.title+'&url='+window.location+'" frameborder="0" scrolling="no"></iframe>');

Open in new window