View Full Version : taking the title of the framed page
there is a framepage that has 1 window in it.
like this:
<HTML>
<HEAD></HEAD>
<FRAMESET ROWS="100%,*" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
<FRAME NAME="top" SRC="http://www.blabla.com" NORESIZE>
</FRAMESET>
</HTML>
you see that there is no title on this page. what i want to do is, to take www.blabla.com's title and set it as the main page's title.
i mean if the title of blabla.com is "welcome to blabla" then, the title of this framepage will be "welcome to blabla".
how can i do that?
Just include the
<TITLE>YOUR TITLE</TITLE>
back in the frameset page.
Note
This then will always be the title irrespective of what page you load
If you want to load the current pages title use:
<script>
parent.document.title="Your Title"
</script>
In the page loaded into the frame.
that is not i want man.
first. www.blabla.com does not belong to me.
so i cant put that js code into that page.
i have to put some code in the frame page that will fetch www.blabla.com's title and set it as the current page's title.
If you are wanting to access information in a document that is contained on another site this cannot be done because of security protocols.
Other than that this script will check every five second for the title of the document loaded in the main frame.
The script itself can be placed in any other frame
<script>
function showtitle(){
parent.document.title=parent.main.document.title
setTimeout("showtitle()",5000)
}
setTimeout("showtitle()",1000)
</script>
joh6nn
10-06-2002, 10:04 PM
hope you don't mind my asking, by why are you framing somebody else's page?
My thoughts exactly joh6nn
:confused:
:D
realisis
10-06-2002, 11:45 PM
yeah, I can think of likely scenarios, but I was wondering about the "why" too...
You're all aware of course that once the "other" page is framed, the URL that appears in the location bar is the frameset's URL, not the framed page's URL, so it looks like the page being viewed came from his site. Changing the frameset title completes the illusion.
Sounds fishy, no? Whaddya say Darp?
ahah.
what s this.. every single code in this forum can be used for bad purposes. why are you asking me that stupid thing.
here is the reason if you want to know.
i am working on a kind of url redirection service.
so i need to fetch the title of the redirected page.
and the possible solutions you talk about, dont solve my problem.
any other ideas?
glenngv
10-07-2002, 09:34 AM
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp
SamirDarji
09-29-2004, 02:13 AM
I've read this thread and I'm having some trouble grasping the frame and frameset concepts as well as if a solution to his scenario was found.
Here's my scenario. I have a page with 2 frames, one lower, one upper. The upper one is local, the lower one is external. I want the title on the browser to be the same as the external site in the lower frame.
To answer the why that may come about, the upper frame is a navigation menu. This way, a user can see other sites while still being able to return back to the main site, which among being a site in itself, is a portal for other sites.
jamescover
09-29-2004, 02:19 AM
If you are wanting to access information in a document that is contained on another site this cannot be done because of security protocols
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp
-james
SamirDarji
09-29-2004, 02:22 AM
Thank you for the quick reply. I thought that was talking about directly accessing the file on another server, and assume that once the site is loaded in the other frame on the browser, the title could be taken and made the title. It seems like this should be possible. :confused: Correct me if I'm wrong.
You would only be able to put the url in the titlebar and not the actual page title
<a href="http://www.address.com" target="lowerFrameName" onclick="parent.document.title=this.href">Link</a>
SamirDarji
09-29-2004, 03:45 PM
You would only be able to put the url in the titlebar and not the actual page title
I should've watched my teminology. That's exactly what I'm trying to do--take the titlebar that would normally appear from the external site in the lower frame and make the parent or top frame have that titlebar.
<a href="http://www.address.com" target="lowerFrameName" onclick="parent.document.title=this.href">Link</a>
Let me see if I follow this code correctly. When this link is clicked, the url referred to by the link gets put into the lower frame and then the parent gets the same name on the titlebar. Something tells me I'm probably missing something, so feel free to correct me if I'm wrong.
Let me see if I follow this code correctly. When this link is clicked, the url referred to by the link gets put into the lower frame and then the parent gets the same name on the titlebar. Something tells me I'm probably missing something, so feel free to correct me if I'm wrong.
You follow the code correctly :thumbsup:
SamirDarji
09-29-2004, 05:03 PM
Cool! But in this scenario, the titlebar is static. :( I need it dynamically coming from the titlebar that the lower frame would normally display. Any other tricks?
glenngv
09-30-2004, 06:01 AM
http://www.codingforums.com/showthread.php?p=238352#post238352
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.