Forum Moderators: open

Message Too Old, No Replies

changing title from within a frame

changing title from within a frame

         

KingSOB

2:35 pm on Aug 13, 2002 (gmt 0)



is there a way to change the title from one of the pages within a frameset? and not from the actual frame controlling page..?

like index.html has 2 frames... 1.html and 2.html...
is there any way to make 1.html change the title?

i ask this because i signed up for a domain.. and it forwards to my site.. and it keeps it in a hidden frome so address doesn't change... but i don't have any way to change the title

rewboss

3:19 pm on Aug 13, 2002 (gmt 0)

10+ Year Member



Theoretically yes. It would be:

parent.document.title='My title';

However, there's a catch: it will only work if the document comes from the same domain as the script.

You have a frameset which comes from (say) www.mydomain.com. Within that frameset is a frame with a document that comes from (say) members.somefreehost.com.

The script, then, comes from somefreehost.com -- but the title on the frameset (which is what you are trying to change) comes from a different server. That means you cannot even read the title property, let alone change it.

So the answer to your question is: theoretically, yes; but in practice, no.

moonbiter

3:25 pm on Aug 13, 2002 (gmt 0)

10+ Year Member



Normally you would use javascript to change the title property of the document object, like:

top.document.title = 'New Title'

But if the originating frameset comes from a different domain than your script then it is likely that this is not going to work because of javascript's "same-origin" security policy. Worth a try, though.

<added>
Yeah, what rewboss said. ;) Hey, I'm "preferred" now.
</added>

KingSOB

6:03 pm on Aug 13, 2002 (gmt 0)



doh!

ok thanks for all your help!