Is it possible, and if so how, to get iframe title
how to the master page take the same title iframe which content
ex :
master page any title
&
iframe page by title " Good sit "
How the master page take title iframe page " Good sit "
Is it possible, and if so how, to get iframe title
how to the master page take the same title iframe which content
ex :
master page any title
&
iframe page by title " Good sit "
How the master page take title iframe page " Good sit "
With javascript this can only be done for pages on the same domain. And, if testing locally in some browsers the pages have to be in the same folder:
Notes: There are simpler ways to go about this (it's old code I had lying around), but the pages still have to be on the same domain. If you need to do this cross domain, you need to use javascript and a server side language like PHP or asp. And that server has to be configured to allow it to open files from another domain.Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <iframe name="myIframe" id="myIframe" src="another.htm" onload="document.title=this.contentDocument? this.contentDocument.title : this.contentWindow.document.title;" width="300" height="300" scrolling="auto" frameborder="1"></iframe> <script type="text/javascript"> (function(el, w){ function loadFunc(e){ e = e || w.event; var f = e.target || e.srcElement, fb = f.contentDocument || f.contentWindow.document; document.title = fb.title; } if (w.addEventListener) el.addEventListener('load', loadFunc, false); else if (w.attachEvent) el.attachEvent('onload', loadFunc); })(document.getElementById('myIframe'), window); </script> <br> <a href="yet_another.htm" target="myIframe">Yetti</a> </body> </html>
Oh, and I just noticed this doesn't work in Chrome, at least not locally even in the same folder. Just tested live though, and it does work in Chrome live.
Last edited by jscheuer1; 09-06-2011 at 09:14 AM. Reason: add - Oh, and I just noticed . . .
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
can you see egyview.com/test.htm
I want this ( test.html ) take the title of iframe page (egyview.com )
Notes : iframe page not fixed
Last edited by jscheuer1; 09-06-2011 at 09:29 AM. Reason: formatting
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body> <p align="center">I Need help</p> <p align="center">I want this ( test.html ) take the title of iframe page ( <a href="http://www.egyview.com">http://www.egyview.com</a> ) </p> <p align="center">Notes : iframe page not fixed </p> <p align="center"> <iframe name="I1" src="http://egyview.com/" width="622" height="234"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe></p><script type="text/javascript"> document.getElementsByName('I1')[0].onload = function(){ document.title = window.frames.I1.document.title; }; </script></body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thank you very much
Is it possible to bring (title, description, keywords) from the iframe page to home page
As shown in this link: egyview.com/test2.htm
Last edited by jscheuer1; 09-07-2011 at 01:49 AM. Reason: formatting
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <p align="left"><b><font size="5">title : ( <font color="#FF0000" id="thetitle">title from iframe</font> )</font></b></p> <p align="left"><b><font size="5">description : ( <font color="#FF0000" id="thedescription"> meta name="description" from iframe </font> )</font></b></p> <p align="left"><b><font size="5">keywords : ( <font color="#FF0000" id="thekeywords">meta name="keywords" from iframe </font> )</font></b></p> <iframe name="I1" src="another.htm" width="300" height="300" scrolling="auto" frameborder="1"></iframe> <script type="text/javascript"> ;(function(frame){ document.getElementsByName(frame)[0].onload = function(){ var d = window.frames[frame].document, dt, dd, dk; document.title = document.getElementById('thetitle').innerHTML = (dt = d.title)? dt : 'Untitled'; document.getElementById('thedescription').innerHTML = (dd = d.getElementsByName('description')[0])? dd.getAttribute('content', 0) : 'No Description'; document.getElementById('thekeywords').innerHTML = (dk = d.getElementsByName('keywords')[0])? dk.getAttribute('content', 0) : 'No Keywords'; }; })('I1'); </script> <br> <a href="yet_another.htm" target="I1">Yetti</a><br> <a href="another.htm" target="I1">Bob</a><br> </body> </html>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
In the source of what page? It's already in the source of the page in the iframe. You cannot change the source code of the top page using javascript.
It does show the requested information on the top page when viewed in the browser:
http://home.comcast.net/~jscheuer1/s...le/index_3.htm
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks