SitePoint Sponsor |
|
User Tag List
Results 1 to 10 of 10
Thread: Changing Browser Title
-
Aug 11, 2001, 23:54 #1
- Join Date
- Jul 2001
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Changing Browser Title
Right now I have a web page that loads two frames, a top frame that always stays the same (it displays a banner ad along with some search engine text) and a bottom frame which displays a different web page every time. I'd somehow like to set it up so the title displayed in the browser is the title of the html page shown in the second frame. Does anyone know how to do this, I assume with Javascript.
Thanks
MattInternet Consultant with 8 Years Experience
Business Idea/Partnerships contact me, m@zii.com
AIM: MattFS218 / ICQ: 5138409
-
Aug 12, 2001, 10:00 #2
- Join Date
- Mar 2001
- Location
- northern Maine
- Posts
- 52
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
top.document.title=document.title;
-
Aug 15, 2001, 02:30 #3
- Join Date
- Jul 2001
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hrm...I can't seam to get it to work....maybe I didn't explain my situation clearly enough
I setup a test url at
http://64.75.41.201/test.html
I want the document title to be "Yahoo!" (the <title> of the bottom frame).
If the bottom fram always changes .... how can I set the title of the web browser to the title of the bottom frame?
Thanks in advance.
MattInternet Consultant with 8 Years Experience
Business Idea/Partnerships contact me, m@zii.com
AIM: MattFS218 / ICQ: 5138409
-
Aug 15, 2001, 08:32 #4
- Join Date
- Mar 2001
- Location
- London, UK
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yo,
Jkd's solution won't work because document.title is a read-only property.
So I figured you'd need to have some JavaScript execute inbetween the <title> and </title> tags that writes the frames[1].document.title property. Except this doesn't work, the code doesn't get executed, just displayed as the title. Doh!
Anyone think of anything else? This should be simple! Heh.
-
Aug 15, 2001, 08:59 #5
- Join Date
- Mar 2001
- Location
- northern Maine
- Posts
- 52
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
document.title is mutable in IE4+/NS6. Try it, save this file onto your hard drive and view it:
Code:<html> <head> <title>Original Title</title> </head> <body> <a href="#" onclick="document.title='Overwritten title';return true">Click to Change Document's Title</a> </body> </html>
-
Aug 15, 2001, 09:12 #6
- Join Date
- Feb 2000
- Location
- where the World once stood
- Posts
- 700
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
As jkd implied and Rips discovered, Netscape 4+ doesn't allow you to change the document's title. If you would like more information, see "The Title Property" snippet at my site.
Insofar as your problem, your only solution may be to reverse your frames so that the static frame is on the bottom.
VinnyWhere the World Once Stood
the blades of grass
cut me still
-
Aug 15, 2001, 11:51 #7
- Join Date
- Jul 2001
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Okay, so why does this not work.
<HTML>
<FRAMESET FRAMEBORDER=0 FRAMESPACING=0 BORDER=0 ROWS="50,*">
<FRAME SRC="http://www.infoseek.com">
<FRAME SRC="http://www.yahoo.com" onLoad="document.title=frames[1].document.title;return true">
<NOFRAMES>
<BODY>
non frames
</BODY>
</NOFRAMES>
</FRAMESET>
</HTML>
If i do an onLoad="document.title='dsfsdfsd';return true"
I can get dsfsdfsd as the title...but not the Yahoo! title.
MattInternet Consultant with 8 Years Experience
Business Idea/Partnerships contact me, m@zii.com
AIM: MattFS218 / ICQ: 5138409
-
Aug 15, 2001, 12:53 #8
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Are you referencing the correct frame? The [1] indicates that you are actually referencing the 2nd frame. Javascript starts its counting from [0].
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Aug 15, 2001, 13:23 #9
- Join Date
- Feb 2000
- Location
- where the World once stood
- Posts
- 700
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi Matt,
Does the phrase "Access is denied" ring a bell? If you put an alert in the onLoad (alert(document.title)) you will see a blank. If you add a title to your page <title>test</title> the alert will display 'test' -- anything else comes up with the access message. The implication? -- you do not have rights to put someone else's title on your page -- offhand, I would say that is a good thing.
Creole: his numbering is correct since he is attempting to assign yahoo's title (frame[1]) to the entire document.
VinnyWhere the World Once Stood
the blades of grass
cut me still
-
Aug 15, 2001, 14:13 #10
- Join Date
- Jul 2001
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Vincent,
Thanks for your help. If I reversed the frames (put the static page on bottom), is it possible to accomplish what I'm trying to do? Or is there a way to go out and manually parse the document for the <title> flag?Internet Consultant with 8 Years Experience
Business Idea/Partnerships contact me, m@zii.com
AIM: MattFS218 / ICQ: 5138409
Bookmarks