473,378 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Frameset title tricks

If I have a frameset page with a frame in it, how would I use JS to get the title of the framed document and set it as the title of the parent frameset page?

If that makes no sense, please ask for clarification.
Jan 21 '08 #1
11 1795
Anyone have an idea about this?
Jan 22 '08 #2
acoder
16,027 Expert Mod 8TB
Do you want to set it from the framed page or the frameset?
Jan 22 '08 #3
Do you want to set it from the framed page or the frameset?
I want to take the title from the framed page and set it as the browser window's title, to put it simply.
Jan 23 '08 #4
acoder
16,027 Expert Mod 8TB
The reason why I asked was that if the framed page changes, do you now need to update the title?

To set the title from the framed page:
Expand|Select|Wrap|Line Numbers
  1. window.onload= function() {
  2.   parent.document.title = document.title;
  3. }
To set it from the frameset:
Expand|Select|Wrap|Line Numbers
  1. function changeTitle() {
  2.   document.title = window.frames[frameName].document.title;
Jan 23 '08 #5
Because of the circumstances of the system I've set up, the frameset will reload every time the framed page reloads. And I need to set the title from the frameset page, but when I do[html]<frameset onload="changeTitle()" ... >[/html], it doesn't seem to work.

I basically need to set the page title, from the frameset page, as soon as or before the framed page loads. How would that be implemented? I'm really Javascript-dull, sorry. :x

The name of the frame is "main", by the way.
Jan 25 '08 #6
By the way, I stuck an alert("firing"); in there and it showed up, so the function's being called, I guess the JS isn't right?
Jan 25 '08 #7
acoder
16,027 Expert Mod 8TB
Can I see your code? This code works:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <script>
  3. function changeTitle() {
  4.   document.title = window.frames["main"].document.title;
  5. }
  6. </script>
  7. <frameset cols="50%,50%" onload="changeTitle();">
  8.   <frame src="script.htm">
  9.   <frame name="main" src="script2.htm">
  10. </frameset>
  11. </html>
Jan 25 '08 #8
[html]<script type="text/javascript">
function changeTitle() {

document.title = window.frames["main"].document.title;

}
</script>
</head>
<frameset rows="100%,*" onload="changeTitle();" frameborder="NO" border="0">
<frame name="main" src="http://mysite.com:8080/<?php echo $_GET['page']; ?>">
</frameset>[/html]

As you can see, there's only one frame involved, and it covers the entire page. It's part of a cloaked redirect system that would hide the ":8080" of a home web server, but I don't see how any of that would stop it from working.
Jan 25 '08 #9
acoder
16,027 Expert Mod 8TB
Are the frameset and frame pages from the same domain?
Jan 25 '08 #10
No. Oh, it's XSS security, isn't it? Gah.
Jan 25 '08 #11
acoder
16,027 Expert Mod 8TB
No. Oh, it's XSS security, isn't it? Gah.
Yes, you can't access pages from another domain. The workaround would be to use some server-side code to get the page and load it into the frame and then document.title would become accessible to the frameset page.
Jan 28 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JP | last post by:
Hi, How can I create a dynamic frameset whose content changes based on user inputs? Specifically, how do I toggle a frame within a frameset? How can I allow a user to "close" or "dock" a...
3
by: BlackSabbath | last post by:
Hi, all I try to explain (with my #@^^~ english..., sorry...) : I have a page e.g. Product125.htm I would that, if a guy call http:\\www.MySite.htm\Products\product125.htm to force the...
6
by: Wladimir Borsov | last post by:
I would like to load multiple web pages from Internet into ONE single browser window - one below the other. How do I do that most easily ? One idea is to built a frameset (for e.g 6 web pages)...
12
by: Blake West | last post by:
Is there a way to write a CSS selector to point to the body tag in a specific frame? The frameset HTML looks like this. I only want to select the BODY tag in the frame named "navbar" and then...
5
by: adnanx82 | last post by:
Hi, I'm having a hard time figuring out why the onload event is not being called for the frameset window in the following simple example. It is being called for each of the component frames. ...
14
by: Alex Molochnikov | last post by:
Is there any way to embed the HTML code inside FRAMESET? Something like this: <frameset cols="50%,*"> <frame src=" ... HTML code for the frame ... "> <frame src="Frame2.html" name="main">...
2
by: TR | last post by:
Given the following frameset named MyFrameSet.htm: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"> <html> <head><TITLE>LaunchFrame</TITLE> <FRAMESET ROWS="88%,12%"> <FRAME...
3
by: rick2910 | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
12
by: Geoff Cox | last post by:
Hello I'm having a problem loading a frameset file using an include in a php file. Nothing is displayed and when I look at the source code I see that <html> <head> <title></title>
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.