Feedback on: Re-directing access within Frames #2
You should warn that location.search is empty in IE3 if the page is loaded from harddisk.
Netscape dislikes the lack of http://....../ in the statement
top.location.href = 'myframe.htm?' + self.location.href;
and it is also not correct syntax.
top.location.href = 'myframe.htm' is ok syntax
but you are setting both href AND search in one go so in my
opinion the following is better:
h = location.href;
(p=h.lastIndexOf("/")) > 0 ? homedir=h.substring(0,p+1) : homedir = ""; // also usable with the opera replace
top.location.href = homedir + 'myframe.htm?' + self.location.href;
and the opera (or just use it as default) would be
location.replace(homedir + 'newpage.htm')
I am not going to go into the danger of document.write('<FRAMESET...>') but both IE and Netscape 16 bit HATES that!
Michel
h = location.href;
(p=h.lastIndexOf("/")) > 0 ? homedir=h.substring(0,p+1) : homedir = ""; // also usable with the opera replace
top.location = homedir + 'myframe.htm?' + self.location.href;
Michel
>make a generic script that >calulates the absolute path >using:
(btw typo in calulates)
Your calculation:
newURL = location.protocol + '//' + location.host + location.pathname.substring(0,location.pathname.lastIndexOf('/')) + '/newpage.htm'
Seems generic but when i work local/offline in MS IE 3 i get a pathname like
Even if i try to stubbornly open it with only / slashes, but that is immediately corrected to \ again.
So /c:\data\evwdemo\index2.htm
will of course be stripped to zilch/nada/noppes.
How then ? So this one must be stripped in another way. I'll try to swap all \'s to /'s first (nasty workaround) but since you understand it all a bit better than i do....
chris hayes
droevendaal
wageningen
IE3 gives pathname:
/c:\data\evwdemo\index2.htm
i tried stripping with '\\' in stead of '/' (NB '\'is escape character), resulting in correct path for IE3 but empty path for NN3.
chris
but anyway, i now work with:
slash1=location.pathname.lastIndexOf('/');
slash2=location.pathname.lastIndexOf('\\');
if (slash1 window.location.pathname.substring(0,slash1) (I think it could be cleaner & shorter.) chris Worth: Length: Technical: Comments: Thanks for an excellent site, and keep up the good work. Charles Dawes. Worth: Length: Technical: Comments: I must thank your for the information provided in the article "Re-directing access within Frames #2". That kind of information is exactly what everyone using frames needs (even if they sometimes don't know it yet). I'm a Javascript newbie, but I have tried to rewrite your code as to support sites that uses subdirectories, and as far as I can tell, it works. I have also written it in such way that the same code could be used by all pages at the site (that is, all pages which should appear in the same frame), which simplifies the implementation if you have a big site and gives you the possibility of puting the code in a *.js file. The con is that the code must contain the absolute URL to the path of frameset.htm. Here's the code (for the pages to appear in the "main" frame) <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"></SCRIPT> Worth: Technical: Comments: For example: I hope I made it clear what the problem was. And I also hope there is a solution for this problem. Mark Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: This is a terrific article (as I said in the clj group), but I've got a small piece of bad news: the method no longer seems to work with Opera, at least not with 3.51 and 3.6beta. I'm not sure it's worth making it work, but I thought you ought to know... Best wishes, Edward Mendelson Worth: Technical: Comments: A named diagram of the 3 window example to begin with would be helpful. I got that working. But jumping immediately to the 5-WINDOW example to explain the ultimate "back button & IE bug-free version" was too complex for a layperson like myself. I'm trying to reverse engineer the javascript of this ultimate version to use in a 3 window execution ("index.html - the frameset, nav.html, and contents.html) but I can't get grammer of the script correct. It changes too much from the 3 to 5 frames example for me not to stuff up without a fairly advanced knowledge of javascript. (One particular comma sequence has me flummoxed.) Is there any way you put up or email the final perfected backhistory-bug free version for a 3-window frameset? Because I'm sure I'm not alone here. And it's a very worthwhile script!!! Thanks for your fantastic site Worth: Length: Technical: Comments: Please look at my question http://www.bnn.com.au/blearning/frameset.htm PS I stumbled across a list of articles by martin web on this web site they look so very impressive and most seem to be of the Worth: Comments: Worth: Length: Technical: Comments: Also, one of these links in the front page goes to a secure page. When I specify the absolute URL for the link eg. HREF="https://www.cadgroup.com.au/frameset.htm?title.htm&contents.htm&company/purchase/index.htm", it returns the HTTP 404 - File not found PS A great article and very useful. Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: Bob Worth: Length: Technical: Comments: I was very glad to find this article even if I'm not very familiar with JS. I got a little problem with the script from "Re-directing access within Frames #2" because I'm building a web site that contain a lot of pages and I want a script who don't need to be customized page by page. I've find this solution. self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/')) + '/frameset.html?frame1.html&main.htm'; Worth: Length: Technical: Comments: I do have a further question though...... Taking the simple example where there is a frameset which displays a left hand menu frame as well as a second frame containing content on the right. Is it possibile to display each of the 'content' files in the correct frameset if all of the 'content' files reside in different sub directories of frameset.htm?? e.g. frameset.htm displays menu.htm and one of content1.htm, content2.htm, content3.htm etc etc if content1.htm, content2.htm and content3.htm all reside in different sub-directories can the code be modified to correctly display each of the content files in the correct frameset???? I've tried passing the full URL of the content'X' frame to frameset.htm, but to no avail Thanks for your time, Chris. Worth: Comments: Found your site through a recommendation in usenet. Keep up the good work! Technical: Comments: Can you tell me how to correct the script language in the lower left http://www.netel.com/testsearch/startframe.htm The current code looks like this: <P><B> Search for a Topic</B> </SELECT><INPUT type="button" value="Go To" The parent frame name is 'startframe.htm'. Loaded in its left column is All these files reside in the 'testsearch' folder in case you need to take a Thanks, - Clark Thompson Worth: Comments: Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: Worth: Technical: Comments: Thanks, Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: Well I tried out the last example, but obviously do not have things quite right. I sent you email earlier explaining how my frames are Problem #1: When I access a content frame page other than the home page it returns me to the home page not the content page I wanted. Problem #2: I have put a title on my index.html file that defines the frames, as "Home Page", how do I get the title from whatever Thanks for any help you can give, Worth: Length: Technical: Comments: www.sandrails.com/index.html is the home page and you can use www.sandrails.com/engines/page1.html as a test thanx for whatever help you can give Worth: Technical: Comments: Worth: Length: Technical: Comments: Also - could I suggest that you use better nmaes for the frames? It's more likely that default.htm will contain the frameset for example, rather than be a frame itself. You haven't defined the frame names and frame page names in this article and they're not the same as in article #1 (where you did define them). Excellent site though.... :-) Technical: Comments: I have developed a Netscape4x (only) application for my company where I use (up to a max of 17) transparent gifs as LAYERS to build up a store plan showing the various IT infrastructure elements within a store. Although there are only 17 actual layers, several of them are alternatives of the same type of equiptment, so the combinations are many times this number. The user 'builds' his store by picking from a list of options (buttons for multiple variants, check boxes for single variants) This is performed from a seperate frame (html file), which calls various layers in the parent frame either "show" of "hide". It works fantastically well and everyone is very impressed. Two problems though - and this is where I need help please! 1) The plans are quite big and therefore the parent frame has to be scrolled both up/down and left/right to navigate round the plan. 2) How can the user then print the plan - again showing and printing all the 'open' (shown) layers as if it were a single gif file? Many thanks in advance Regards Nick Pearce Worth: Comments: I have a page which has a frameset with two frames, left and right, named "NavBar" and "MyContent. In the left frame I have "navigation" links of the form However, some of the URLs used for the right pane, e.g. http://somehost.com/somepage.html (the source of which is out of my control) have the following javascript in the head: <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> Do you know whether it is possible in a page (e.g. my page, with the frameset) to specify that javascript shall be disabled within the page? Or perhaps there is something with javascript itself which can b used do this (force a URL to appear in the frame, rather than allow it to force itself to the top), without sending the browser into an infinite loop. The browser is Netscape Communicator 4.73 Thanks if you have time to answer this... Worth: Comments: However, the instructions on how to do that were only included with examples for the "Multiple Frame Version" Anyway you could also show how to enable the back button and printing for the "Simplistic Frame Re-direction"? Thanks! Fabulous site! Worth: Comments: I found one problem, which was that the frame name being tested for was not quoted as a literal. Another is that, depending on *which* frame is being tested for, you may encounter a javascript error. It seems that testing for the firstmost frame in a set will not generate an error, but when I tested for the last frame in my set (which happens to be the only one with variable content), I did encounter an error every time. Worth: Comments: However (and this is possibly the important bit), I think I've seen a small bug in your script. It uses the code var newURL = self.location.protocol + '//' + self.location.host + self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/')) + '/frameset.html'; to generate the new URL. I suspect that this won't work on HTTP servers not running on port 80 - there may be a need to add a ":portnumber" in the URL, though without a spec. for location.host I can't be entirely sure. Supplimentary comment; I can't find a reference or a link to a reference to describe the JavaScript object model on irt.org. If I could, then I would be more sure on the above. A definition to the object model would be a huge benefit, IMHO. Greg Worth: Comments: It reads document.write('<frame src="rightframe.htm" name="myframeset">'); I could be wrong, but this might be worth looking into. Worth: Length: Comments: Here is my problem: thanks...all your examples worked mary Worth: Comments: Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: I have just a remark because of which I do not use a redirect in my sub-framepages. A while ago I have search the internet for a script to redirect a visitor to the main (frame) page if they somehow enter the site on a page that should be displayed in a frame. I found a code, but there was a warning about search engines. It says that most search engines think you are spamming them, if a each single pages of your site redirects to the same main page. I have know idea id that is realy true, but to be on the save side I just avoid the redirect and place a "home" button ob every page. JP Worth: Technical: Comments: Worth: Length: Technical: Comments: Worth: Length: Technical: Comments: Worth: Comments: Do you remove that section of the contents? If so why? Length: Technical: Comments: But if I acces form child-page i see only white screen. Also in some program helping develope during star I have alert that I have dont permition in child-pages in line 7 sign 5 (second "if") I have no idea how correct it. (second problem doesn't important but first is so) (IE6.0, Windows XP) Worth: Length: Technical: Comments: parent.frames.1.name is null or not an object. But the script work somehow after pressing yes to the error window. Help... Thanx. Worth: Comments: http://squaresoft.250free.com/js/index.html hope this scripts helps you Comments:
Now i need to test it on other browsers...
Worth reading
Just right
Just right
Just thought I'd say that Ivan Peters who wrote the Joust menu system (www.alchemy-computing.co.uk) has found a way to let Netscape 4.x print from the frameset even when there is JavaScript code to control the loading of the page. This article implies it is not possible when it is.
Very worth reading
Just right
Just right
Hi Martin Webb!
Very worth reading
Just right
The shown code works fine on certain sites.
But what if certain pages are in a different directory. Then I stumbled onto problems.
if a single page is loaded from the directory "Home/Pages" and then has to go to the directory "Home" to 'get' the frames (menus and other pages), then the code wouldn't work as well as if all the pages were put in one single directory.
Very worth reading
Just right
Just right
this (as with all your articles) is an excellent piece of scripting.
I'm try to use it on a site with only one problem. I've got a sitemap (static) inside a frameset when a link is followed the page pops up and then pulls it's frameset around it, beautiful except when you then hit your browser' back button you don't go back to the sitemap
Very worth reading
Just right
Just right
Martin and Jan,
Contributing Editor
PC Magazine
Very worth reading
Too technical
Martin - I'm struggling with this article.
James
Very worth reading
Just right
Just right
As the ticks says the authors have done a excellent job. One can expect from the excellent foundation laid other will want to adapt this successful working example to ones own situation hence a add on question will always come along such as my question
from David Lukin
subjects that I want to next learn.
Any benifit that can be bestowed on to the org web site in general is a benifit well deserved.
As my other friends are also impressed with the cgi and perl and data base articles. The Dynamic html articles make this web site the no 1 site to visit for the best real value.
Very worth reading
Great - I NEEDED this article.
Very worth reading
Just right
Too technical
I have a front page with no frames and a few links. From any link I can load the frameset and specify what documents get loaded into what frames in IE5.00. Briliant. In IE4 SP2, only the default documents load into the frameset ie title.htm, contents.htm and main.htm.
Any ideas????
Internet Explorer error.
I have know idea why???
Very worth reading
Just right
Just right
Just great - simple and effective solutions to one of the web's most annoying problems.
Worth reading
Too long
Too technical
The first page of my site is not a frames page.
This page loads the nested frameset that functions for the rest of the site. If people access an individual frame of my site I'd like to have them redirected to the home page of my site.
Any ideas on how to do this?
PS I voted "too technical" but that is simply my lack of JavaScript knowledge.
Worth reading
Too long
Too technical
Hi,
First I think that irt.org is the best source for JavaScript on the net ! :-)
Change this line in the script in the contents of the frames from :
Very worth reading
Just right
Just right
I thought the article was great. It was an exact description and solution to a problem I was facing. It sorted it right out...thanks.
Any pointers to a solution would be greatfully recieved.
Very worth reading
Excellent article - has taken me many hours trawling through the internet to find such a comprehensive answer to a problem I'm sure is very common.
Too technical
I am a beginner at this.
frame of this website so that the topics retrieved by the Search engine will
display in the right frame as they do when using the Table of Contents?
<BR>Click the entry you want and then click '<B>Go To</B>'
<P><FORM><SELECT name="list" size="5">
<OPTION value="topic1.htm">Topic 1;
<OPTION value="topic2.htm">Topic 2;
<OPTION value="topic3.htm">Topic 3;
onclick="top.location.href=this.form.list.options[this.form.list.selectedInd
ex].value">
However, this causes the searched topic to fill the entire window - which I
do not want.
'leftcolm.htm' which, in turn, contains 2 rows. The top row displays
'toc.htm' and the bottom row displays 'list.htm'. The name of the frame in
the parent I want the search topics to appear is named "right".
look at them.
Very worth reading
The script redirect fine if one of the pages is bookmarked, s othe whole frame is loaded. But, it does not PROPERLY bookmark if the content of 1 frame is been replaced with another document (script always return to the content.htm, title.htm and main.htm) : if 'contents.htm' is replaced with, let's say 'contents1.htm', and bookmark it, the link would return 'contents.htm'.
Very worth reading
Just right
Just right
Great article. I did have one problem implementing the frame-detection scripts, though. The scripts work great if all of the files are in the same directory as the frameset and the original pages in it. However, my site is pretty big and has quite a few subdirectories, and when I load one of the pages in the subdirectories, the search can't find the contents page, main page, etc. since it is only looking in that subdirectory. This should probably be pretty easy to fix, and I am working on it. If you happen to have already thought of this and have a fix already, please let me know.
Very worth reading
Just right
Just right
Here's a fix to the subdirectory problem in my last email. This only works for pages that have only one level of subdirectories in the main page directory, but could be modified pretty easily for more levels. For that case, something using the 'split' method might be nicer. I've modified the search string so the filename doesn't have to be put in separately for each page. I don't know whether you guys have one of these already, but for what it's worth:
Very worth reading
Too technical
I am currently trying to kick my web page out of someone elses' link. They have designed a frameset with an invisible frame, and when it links to my site the advertisement(mandatory) on my site gets screwed up because it wants to be on top when the linkor website is. I tried using versions of your code but I can't look for my page to be on top because the advertisement banner is supposed to be and very much has that same type of code implemented in its program. I was hoping it was possible to have a front page that could kick out the linking website in the process of linking to my own. curious if possible or whether I could use some of your code by some way of left window = my menu. My page is located at www.bcity.com/medicalresearch
Darleen Lansing
Worth reading
Just right
Not technical enough
I've been looking all over the internet for this type of script... this is the only place where I can find it. I don't know much about java at all... everything java I use was either obtained from websites or ripped from pages... I can't follow the examples... I would like to get my page set up with this type of stuff.... if I explained the full deal in length could you give me a hand at all?
Very worth reading
Too short
Not technical enough
Hi again,
set up: title frame across the top, on the left a menu frame and under it an info frame and to the right the content frame.
content page I am on to display instead of always having "Home Page" displayed?
Laurelle
Very worth reading
Just right
Just right
it was a good article and I got it working in IE, but for some reason it isn't working in netscape? do you think you could take a look at it? maybe I did something wrong
Very worth reading
Just right
I don't know much Java but this helped me out a great deal.....Only I have found an issue I have been trying to resolve:
I have gotten the re-direct to work for pages within the same directory as the "frameset.htm", but I can't seem to get pages under different directories to load the frames.
Any help would be appreciated.
Thank You,
Bryan Scott
Very worth reading
Just right
Just right
Excellent article though there is a small error: Simplistic Frame Re-direction first block of code the != myframeset should be in single quotes i.e. != 'myframeset'
Too technical
I am not sure if you can help me, I am a fairly experienced WEB developer, although my Javascript skills are still somewhat limited.
How can I open this parent frame in a new window and still keep all the user selected option layers showing (eg. some hidden, and some showing)?
Very worth reading
I am trying to find out something (I am not an HTML or javascript expert) and found this article. I did not find what I was looking for (although maybe it was there and I did not recognize it!) but the nature of it led me to think you may know the answer to my question.
<A target="MyContent" HREF="http://somehost.com/somepage.html">Some Host</A>
which results in that URL taking up the entire window, instead of just the frame "MyContent". I would like to disable this. Of course I can disable javascript for the whole browser, but this becomes tedious, because for most of the pages I visit it is fine.
Very worth reading
Found it very valuable, but have one problem/suggestion. I have a site that has only two frames within the frameset, and was using the "Simplistic frame re-direction," but wanted to also include "Rewriting History" to allow the back button to work and ensure that Netscape 4 would be able to print.
Very worth reading
This was a little cryptic in spots for me, but with some fussing and experimenting, I was able to adapt it to my needs.
Very worth reading
An excellent article, though I did n't quite understand why you needed the invisible ergi87143548 frame in your example, though this may be because I didn't read the article thouroughly enough.
Very worth reading
I think thier might be a mistake. In the section
'Avoid being Fra-Framed-med'
document.write('<frame src="leftframe.htm" name="myframeset">');
I think it should read
Yogesh
Very worth reading
Too long
Outstanding.
All the examples worked and are helping to solve my problem.
top page loads in 2 frames.
an action in frame[0] pops up a control window, which needs to be use to send output to frame[1].
It works in NN4. but IE does not allow popup to see second frame.
from this article, I see that I should use top as a 'control panel'.
perfectly for me.
Very worth reading
Absolutely outstanding, complete, and well organized. Thanks for your time and effort to explain this.
Very worth reading
Just right
Just right
I am curiuos. About 2 or 3 years ago there was a script I believe in Perl that would from a 3 frame site redirection the first hyperlink right away into the right frame, leaving the first one and the top one alone. Anyone heard of this. I have asked alot of people and they said its used to steal peoples stuff. But again I saw it all around in like netscape 2 or 3 but can't find it again. Please help.
Very worth reading
Too long
Too technical
Hi,
Worth reading
Too technical
Has the info I want, Its just too confusing to get it to work. You need to clarify the parts of JavaScript that need to be changed to match my website. I could get it to work with errors in explorer, but thats it. No good. I need more.
Very worth reading
Just right
Just right
Wow, what a great article... I really don't know anything about Javascript as a language, although I have some programming experience otherwise, but I understood everything you did in that tutorial (it is one, really) :)
However, I noticed that the script doesn't seem to work in certain situations, one of which is mine. That is, because of money shortage, I am forced to host my site at a free hosting provider, and redirect visitors to synchron.org through a hidden frame. You guessed it, this hidden frame seems to disturb some of the inner workings of the script. I don't know if that is of any interest to you, but I mainly wanted to write you to express my gratitude for such a nice article anyway, so there you go :)
Have a nice time.
Worth reading
Just right
Too technical
Hard to follow. Consider using more realistic examples.
Very worth reading
I keep reading the comments and people say here's the script (for selecting a person's page rather than the simplistic main.htm) and the script is gone.
Just right
Just right
Script work in Netscape. Also in I.E if I start from frame.htm.
Very worth reading
Just right
Just right
I use the: Avoid being Fra-Framed-med technique but I got an error message:
Very worth reading
after reading the article and spending an hour working with the code, i created my own working version of this script.. the script i 'created' makes it such that if the only navigation that you have with your website is with frames, and a page by itself has no links to anywhere else.. this script makes it so that all pages will pop into the frames and still be visible. anyhow, if this doesnt make any sense and/or you want to view my source code for this script in an edited version:
I have abandoned this method because there are too many cons.
If the search engine does not use the left panel of IE as designed self != top doesn't work!!!
This combined with other draw backs makes it unusable.
Using s_referer = request.ServerVariables("HTTP_REFERER")
in ASP works best!
The only down side is Netscpe version 4 which does not report the referer.