Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Feedback: Re-directing access within Frames

Feedback on: Re-directing access within Frames

Sent by walter perry on September 09, 1998 at 15:23:33: - feedback #7
More of a question than feedback. We have implemented redirecting access within frames on our site, but we have noticed a problem. If you use Netscape 4.0 then you can not print out those pages that have been redirected. You get an printing error that states the documents have no data. Have you heard of this before and is this just a bug in 4.0. Netscape 3.0 and all of the IE browsers work just fine. Do you have a work around for this problem.


Walter Perry

Sent by Kevin McNamara on September 14, 1998 at 08:05:31: - feedback #9
According to the article, this code should force display of a frameset and load a file into a specific frame in Opera:

var correct_frame = 0 + (parent.nav ? 1 : 0);
if (parent.location.href == self.location.href || !correct_frame)
window.location.href = 'test.htm?display';

So if I read this correctly, the first line references the variable defined in the master frameset document, and also checks for the presence of a given frame in that document. (In this script, the given frame is not the one that accepts the search parameter.) The script then tries to load the master frameset if it can't find what it needs, and to load the file featuring this script into the frame that accepts the search parameter.

We've tried that here several times in Opera 3.21. We've been careful to use not only the same names, but also the same capitalization we use in our frameset. It does not seem to work. Opera just refuses to load the frameset, showing a message that it "cannot open the file." We're not sure what file--we don't get enough of a dialog box to see the complete path to the file that it can't open--but as Opera displays the requested file outside of the frameset, we suspect it can't open the master frameset file.

The file opens just fine, however, in NS and IE, and opening a document from outside the frameset forces the frameset, as desired and expected.

Why might this be? Is this a trick that won't work off line, like the familiar IE buggery? And even at that, we are developing and testing on a LAN; we're not entirely off line.


Kevin McNamara

Sent by Mike on September 19, 1998 at 06:10:08: - feedback #13

Implemented this re-direct to correct frame feature across a whole site with much success.

Tied adding the opera workaround - caused a reload loop in IE4, where page would never eventually load!

Have taken it off and reverted back to script without opera fix

Sent by Iain Hunneybell on September 19, 1998 at 16:11:41: - feedback #15
Apologies---reposting of my last note but with { } substituted for angle braces. Somewhere the html was being understood by the server or browser!


---- Originally submitted note ------

I can not get this technique to work. I'm using IE 4.01 and Navigator 4.5 PR2 - both fail! I've tried all kinds of variations on the theme but to no avail. To confirm what I'm doing:

Frameset defined in index.html}


{script language="JavaScript"}
var correct_frame = true;
document.write('{frameset frameborder="0" border="0" cols="230,*"}');
document.write(' {frame name="nav" target="main" src="nav.html" scrolling="no" noresize}');
document.write(' {frame name="main" src="', (location.search ? location.search.substring(1): "main"), '.html"}');


{p}Sorry, but this site is designed using frames which your browser doesn't support. You
will need to update your browser to view this site.{/p}

Then in the header of a page targeted for the {main} frame:


{script language="JavaScript"}
var correct_frame = parent.location.href == '';
if (parent.location.href == self.location.href || !correct_frame)
window.location.href = 'index.html?main';

{body BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#808080" TEXT="#808080"}

Note I have redefined the variable {correct_frame} as {parent.nav} seemed to have no value and would lead to an endless loop with the page filling itself with frames inside frames - basically filling the screen with the left hand nav bar.

The search parameter in the URL seems to be a major issue. Mabe this is because I'm using MS PWS but all I get is:

HTTP/1.0 403 Access Forbidden (Execute Access Denied - This Virtual Directory does not allow objects to be executed.)

This seems to be the server's understanding of the search extension ot the URL. The reload within frame works okay without the search term, but then of course I can't get the page to reload with the right main page loaded in the {main} frame.

Can you see something I'm doing wrong?


Sent by Rachel Hodgson on September 19, 1998 at 16:43:49: - feedback #16
Having a lot of Trouble!
Am trying to use chatspace but it
says I need java script, Have
riscpc600, acorn, with half win.
Windows internet isn't working
so have to use risc half. Can you
tell me somewhere where I can
download Javascript onto this
compute? Thanks.
Sent by Charles C Martin on September 23, 1998 at 03:06:49: - feedback #17
Excellent Article!!!!

I implemented this into my web site and it worked perfectly.

Only one thing..

My page has frames and I have the dropdown menu on the top frame and when selected I want the requested url to come up in the bottom right frame. When I select from the drop down now the web site comes up in the top frame.

Is there a specific html code I should use to implement this? I am using Front Page 98.

I would really appreciate any help.

God Bless,
Charles C. Martin

Sent by Iain Hunneybell on September 30, 1998 at 18:32:40: - feedback #20
I can not get this tested technique to work. I have now repeated the steps _exactly_ as explained, however, the issuing of:

gives me:

HTTP/1.0 403 Access Forbidden (Execute Access Denied - This Virtual Directory does not allow objects to be executed.)

The server - Microsoft Personal Web Server at this point of testing - is obviously seeing the ?another as a command to and not simply as a passed value and it's not going to put up with it!

Is there an alternative means of passing a value from one page to another or is this just a 'feature' of PWS that's causing me a lot of grief? Can you give me any advice?


Sent by Remko Coltof on October 02, 1998 at 02:44:49: - feedback #21
I wanted to use the last version of the script (i.e. http://www.irt.org/articles/js013/outside.htm)

At first it seemd tot be working perfectly, but a friend of mine then pointed out that this script "Loops" itself in Opera3.2.

With my sites it happend when I try to load the same text page a few time directly (so by typing in the address)

it seems to loop directly.
see what happens!

I cannot find the reason for this.


Sent by Kevin McNamara on October 06, 1998 at 13:14:37: - feedback #25
From the "Checking for *your* frames" section at the end of the article:

Placing this code into our pages causes Netscape Communicator to fail all print commands, informing us that "There are no pages to print". When we remove this code from our pages, they print just fine. Of course, that means we don't get the frame check that this code provides.

This problem does not exist in MSIE; pages print with no problem.

What is it about this code that makes NC think there are no pages to print, and how can this be overcome?


Kevin McNamara

Sent by Kevin McNamara on October 07, 1998 at 10:58:20: - feedback #27

This may feel like piling on, but I came back to the article just to see if the same printing failure I have on my beta site existed in your demo pages.

It does. I try to print the frame that has the frame-checking code in it, and Netscape Communicator (4.07 in my case) tells me there are no pages to print.

BTW, I can't print the page w/this code on it even if I put a window.print() button on the page--still tells me there are no pages to print.

Just so you're aware. When you figure out why these pages won't print, I'd really like to know. If I trip over something that works, I'll get back to you.

Kevin McNamara

Sent by Duif Calvin on October 08, 1998 at 06:06:34: - feedback #28
Actually, I'm sending a note about a different article, http://irt.org/articles/js019/index.htm, on dropdown menus.

As you may know, IE 3 did not support the OPTION object of Javascript. I am working on an application for a site where many of the visitors have IE 3 (and, no, asking them to upgrade is not appropriate for the audience).

I told another developer I thought we would have to do this with CGI, but he insisted it could be done with Jscript. However, he couldn't come up with any way of doing it.

I was a little surprised that your article didn't even mention this issue. Do you have a way of doing this that will work for IE 3, NS 3, IE 4, and NS 4?

Thank you!

Sent by Anders Lund on October 19, 1998 at 16:23:29: - feedback #33
There is a fatal mistake in the article!
You should NEVER test
(self.location == top.location),
as location is a tainted property: if you enede up i a frameset located on another host, it will produce an error! The variable way is correct, but it should be a quite personal one, just for security.
Also, if you end in a foreign frameset, you cannont set "top.location.href", for same reasons. instead, you could write a link to the correct frameset with target=_top, and activate it wite document.links[name].click(),
which does unfortunately not work for some browser versions. Alternative, open a new window withe the correct location...
Sent by Jim Schowalter on November 01, 1998 at 20:02:22: - feedback #39
Thank you for this code. I had read an answer to this question in the 11/98 issue of WEBBuilder magazine. The answer there was not complete like this example. Their solution would load the frame set up (with the default pages included). This was not viable for the situation described (search engines pointing to a particular page and not getting the navigation framework). Thank-you again.
Sent by Marcel Post on November 02, 1998 at 02:46:13: - feedback #40
I still don't get it.

What I would really like, is a "universal" piece of js that can be added to every document that should appear in a right-frame wich checks if it exists in a frameset If it isn't loaded, then do so.

Most js programs have to be added with the specific html-document name. But there must be a way to store the original name of the (right-frame) document, and later load it in a frameset.
Bought myself a book about js, and studied the example shown here, but I still found no satisfying answer.

IS it actually possible ?

The reason I'm asking this, is because our website has a lot of branches, with lotsa documents that all appear next to the same left-frame document (nav.bar). All the documents are regularly updated, and change more radically each year. The js should prevent to show just the right-frame document, when creating a bookmark. It should load the frameset as well, but with a standard piece of js.

With kind regards,
Marcel Post
(The Netherlands)

Sent by Antti Näyhä on November 24, 1998 at 08:04:47: - feedback #52
This feedback is actually about "Fading images in and out" (http://www.irt.org/articles/js059/index.htm), the feedback link on the page produced an incorrect subject.

Opera 3.50 has major trouble with the "Multiple images" and "Repeated images" examples on the page. I *think* it fails to parse the following line correctly:

if (i<4) eval(imgName + 'InTimeout = setTimeout(\'fadeIn("\'+imgName+\'")\',50)');

Is that 100% standard ECMA/JavaScript? In other words: should I file a bug report to Opera or not?

Sent by Cris Perdue on December 11, 1998 at 20:10:43: - feedback #61

Though subject says "Re-directing access within Frames", actually I'm commenting on the "Dropdown Menus" article. I tried clicking the button in the section on "JavaScript events", and the NN4 browser got into an infinite loop of alerts, alternating between "Focus" and "Blur".

Outstanding work on the site; keep it up!

Sent by Bob Langdon on February 09, 1999 at 10:44:11: - feedback #83

Very worth reading

Just right

Just right


FYI: after using js126, everything works great except in MSIE 3.01aPPC (which DOES support the image object), but is very buggy in other areas.

After reading js131, I tried surrounding the HTML Frameset with <NOSCRIPT> so IE3.01a didn't try loading both framsets, but the browser still freezes up every time I try to access my framset document:


I hope this is a Mac-only thing.

Any ideas?



Sent by Charles Hill on June 08, 1999 at 08:52:44: - feedback #228

Worth reading

I tried some of your ideas on frames, but there are certain pages that I do not want in frames. I noticed, that once the frames page is entered, they cannot be turned off. For example, my home page does not use frames, but when I return home using the framed page, my home page is now in frames. How can I keep certain pages from being framed. In other words, can I go from a framed page to an unframed page?


Sent by Daniel James on January 07, 2000 at 16:00:36: - feedback #708


Maybe I'm a little thick, but...

I followed a link to this article which said that this
article provided a solution to the problem of having links
from other sites refer to '_top' or '_parent', and undesirably

I have a nav frame, a heading frame and a content
frame. Some of the sites that appear in the content
frame target '_top'. I don't like this and want to have
anything going to '_top' redirected to my content area.
It looks like your examples--and forgive me if I'm being
thick--require that I somehow have control over the
sites that appear in my content frame (e.g. be able
to place special javascript into their headers); but,
of course, I cannot alter the html/javascript in the
sites that appear in my content frame...

So... am I missing something?

Thank you
- Daniel

Sent by Brian Vozza on April 24, 2001 at 18:49:38: - feedback #2661

Worth reading

Its a great article if you've got access to those pages to determine where to re-direct the page. But what if you dont? Suppose you're embedding a page into a frame or div that contains the following:

if (top.location != self.location) { top.location = self.location }

It will automatically blow out your frameset....everytime. If you attempt to re-direct the navigation...it seems like you'll fall into the never ending loop. Am I misunderstanding the concept of this page or is it just misleading?


©2018 Martin Webb