Solved

set iFrame title for the page

Posted on 2011-09-11
3
174 Views
Last Modified: 2012-05-12
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

0
Comment
Question by:madmare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:dmeeren
ID: 36518548
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.
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 36519201
<html><head><title></title>
<script type="text/javascript">
    function setup() {
        var ifrms = document.getElementById("aa");
            document.title = document.aa.document.title;
    }
</script>
</head><body onLoad="setup();">
<iframe id = "aa" name = "aa" src='http://www.cnn.com' > </iframe> 
</body></html>

Open in new window

The error that is raised is
"Access is denied."
Look at  
http://en.wikipedia.org/wiki/Same_origin_policy 
There is a lot of talk about workarounds  
http://www.google.com/#pq=same+origin+policy+&hl=en&sugexp=gsis%2Ci18n%3Dtrue&cp=25&gs_id=11&xhr=t&q=same+origin+policy+workaround&pf=p&sclient=psy&source=hp&pbx=1&oq=same+origin+policy+workar&aq=0e&aqi=g-e1g1g-m2&aql=&gs_sm=&gs_upl=&bav=on.2,or.r_gc.r_pw.&fp=c7fec8890f99dfa5&biw=1280&bih=856 
I don't know if they will work.  


0
 
LVL 4

Expert Comment

by:h4hardy
ID: 36541440
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

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question