Register  |  Login



Question

Status: Closed Points: 75 Time: 01:05 - Aug 30, 2006  

rosv

How do i force a given URL to load the entire frameset - and not just the specific frame?

The problem is related to search engines redirecting users to a certain frame, and then the frame itself is presented. I want the entire frameset to load - the way it was ment to be shown..
There must be a straightforward Javascript sample to do the trick??

Answer Discussion
Answer Summaries

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

PeterNZ

Date:: Aug 30, 2006

Time:: 05:12

The problem is that the content of your frame is a seperate HTML file. There is no realtionship from the frame content to the frameset! Only the other way - from frameset to frame content. So there is no way to find out to which frame set an html page belongs.

Cheers

Peter

theDude

Date:: Aug 30, 2006

Time:: 09:40

I believe it's possible with javascript to ask if a given part of the frameset has a parent, if that is not the case you reload the parent.
I don't remember the code for it...

andriy.kharuk

Date:: Aug 30, 2006

Time:: 10:20

Just set the "target" attribute of the <A> tag to "_parent".
For example:
<a href="new_link.htm" target="_parent">new link</a>

theDude

Date:: Aug 30, 2006

Time:: 10:47

This has to be automatic, as far as I understood, so an anchor-link is not going to do it, andriy.

If you use this javascript in your framesets children pages, I believe it should work:
if (top == self)
{
location = 'parent_frameset_page.html';
}

rosv

Date:: Aug 30, 2006

Time:: 22:43

theDude: you´re right - ´something like that will work. As a matter of fact, I have found an elaborate explanation here:
http://scriptasylum.com/tutorials/framer...

PeterNZ

Date:: Aug 30, 2006

Time:: 23:17

Sorry guys, but how does a child doc know who is its parent? There is no relationship upwards, as far as I know. Only down from parent to chld. You have a <FRAMESET> in your page which contains <FRAME> which has an attribute for its source like <SRC="Content.html"> where Content.html is just a normal html page. In the code of Content.html is no relationship to the frame etc. So if you do a http://www.mydomain.com/Content.html you have no way of finding out in which frame Content.html belongs! And even if you would be able to find out, you still have to find the frameset to which the frame belongs!

Setting the taget of a link to _parent doesn't help. The question was, how can I force a page to be opened in its frameset if for example the page is found by Google etc. You can't influence the links on teh google serach results page! And by the way, _parent forces the browser to open a page in the same window as opposed in a new window.

But I was thinking about this problem. And I thought the only way could be, that you prevent the page to be loaded at all and redirect to it's parent page. But this has to be hardcoded in the page itself. So if you open the page, you have a java script which says "Hey, I am not supposed to be loaded directly, instead load MyParent.html". I found a script on this webpage: http://www.codelifter.com/main/javascrip...>http://www.codelifter.com/main/javascrip.../a>

============================================================
Script: Open Page in Frameset Script

Functions: If a page is intended to be opened only within
a frameset, this script refers the browser
immediately to the frameset page

Browsers: All

Author: etLux
============================================================

Put the following script in the head of your page. Set the
url of the frameset page where shown below.

<script>

// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

if (parent.location.href == self.location.href){
// change the url below to the url of the
// frameset page...
window.location.href = 'index.html'
}

</script>

============================================================
I tested it and it works. But now I am confused. Because I don't know why it works. There is no relationship from child to parent, only Parent to child! The script even works if the child page is in a subfolder folder of the parent page. Even if it is part of another web site! So please explain someone to me how a child knows which page its parent is!!!

Cheers

Peter

theDude

Date:: Aug 30, 2006

Time:: 23:29

Hehe, Peter, you seem to get to the same conclusion although you dismiss it at the beginning?!
I believe it's the same as when you detect the opener from the page that was opened from another page.
Of course a page in itself opened directly has no idea of who is it's parent. But if it was called/opened in a frameset, it does know who the frame parent is. So basically you're asking from that page whether the page is in a frameset or not, and if it isn't it opens its parent page, which then opens the child page as it should.
Anyway, I would not recommend using frames unless you have some very good reasons for it. In general the disadvantages are bigger than the advantages.

theDude

Date:: Aug 30, 2006

Time:: 23:30

i think this question requires a summary... :)

Question Answered

This question has been closed, and points have been rewarded to the following experts:

theDude: 75

You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for the Summary Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No summaries have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top web development Experts

View More

Rank

Expert

Points

1.

jgivoni

1073

2.

nidhi

890

3.

rcastagna

877

4.

PeterNZ

760

5.

xarcus

620

6.

oracleofDelphi

375

7.

Anpanman

370

8.

theDude

305

9.

redcharcoal

275

10.

rberbe2002

185

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es