...

View Full Version : Detect page title across frames



thesmart1
08-09-2006, 10:13 PM
I have a frameset with several frames, including one called page. Is there a way to detect the title of whatever site is loaded in the page frame and use that as the title of the browser window?

brandonH
08-10-2006, 02:18 AM
yes it can be done. if you are using frames then i am sure you are familiar with naming frames, and that the browser window is the parent.

so do as such:

detect an inner frames title:

var tit=parent.yourframesname.document.title;

then assign that value to the parent window's title:

parent.document.title=tit;


its that simple.

_Aerospace_Eng_
08-10-2006, 02:28 AM
Just be aware the above won't work on sites not on your own domain. Seeing as how you plan on using a local page on your system (which I think is pointless because this is exactly what a browser does) you won't be able to get the titles of other sites not on your system.

brandonH
08-10-2006, 02:39 AM
not totally true Aero. it is possible, just gatta know how to do it. i currently have a plain html file on my local hardrive that accesses any site i want it to and grabs the entire content of said site. of course it prompts the user that the script is trying to access something not under its control, but if the user clicks allow, it still does it, and if you just change the .html to .hta it now runs as a hyper text appliocation, which has granted higher security rights. so running as an .hta file the user wont get prompted about cross domain issues. of course .hta is a microsoft internet explorere thing only, so it wont work for all browsers or operating systems.

_Aerospace_Eng_
08-10-2006, 05:08 AM
Hmm but what about a browser like Firefox? Could you get it allow access to non local sites? I know about the hta stuff and the warnings that will popup.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum