Feedback on: Re-directing access within Frames
Thanks,
Walter Perry
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.
Thanks,
Kevin McNamara
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
.../Iain
---- 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}
{html}
{head}
{title}...{/title}
{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"}');
document.write('{/frameset}');
//--}
{/script}
{/head}
{body}
{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}
{/body}
{/html}
Then in the header of a page targeted for the {main} frame:
{html}
{head}
{title}...{/title}
{script language="JavaScript"}
{!--
var correct_frame = parent.location.href == 'http://127.0.0.1/entersource/index.html';
if (parent.location.href == self.location.href || !correct_frame)
window.location.href = 'index.html?main';
//--}
{/script}
{/head}
{body BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#808080" TEXT="#808080"}
etc.
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?
Thx.../Iain
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
http://127.0.0.1/js/test.htm?another
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?
Thx.../Iain
iain@ipmarketing.co.uk
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)
With
http://www.irt.org/articles/js013/dummy.htm
it seems to loop directly.
see what happens!
I cannot find the reason for this.
Anyone?
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?
Thanks,
Kevin McNamara
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
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!
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)
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?
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!
Worth:
Very worth reading
Length:
Just right
Technical:
Just right
Comments:
Hi,
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:
retailernews.com/index.shtml.
I hope this is a Mac-only thing.
Any ideas?
Thanks,
Bob
Worth:
Worth reading
Comments:
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?
Thanks
Comments:
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
so.
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
Worth:
Worth reading
Comments:
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?
Brian