View Full Version : Detect page title across frames

08-09-2006, 11: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?

08-10-2006, 03: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:


its that simple.

08-10-2006, 03: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.

08-10-2006, 03: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.

08-10-2006, 06: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.