Re-directing access within frames - Revisited
Ewout Wierda on November 06, 1999 at 06:50:00:
Very worth reading
The first problem relates to files in folders. In larger sites, say at the fictional site "www.website.com", it may well be that a number of files which should find place in the "main" frame, are placed in folders. For example, the file "main2.htm" might be placed in the folder "mainfiles", so that the full reference to that file would be "http://www.website.com/mainfiles/main2.htm". In this situation, your scripting would render the following non-existing URL: "http://www.website.com/mainfiles/frameset.htm?contents.htm&title.htm&mainfiles/main2.html". In other words, the scripting causes the browser to expect that the files referred to are in the same "mainfiles" folder as where the "main2.htm" page is placed.
I believe the cause for this problem is in the coding " lastIndexOf('/') ". This coding is found, as you are no doubt aware, in the definition of "var newURL". If two dots are inserted before the slash, as in ' lastIndexOf('../') ', then the problem is solved, and the resulting URL is as it should be: "http://www.website.com/frameset.htm?contents.htm&title.htm&mainfiles/main2.html".
I hope this may be of help to those who work with folders.
The second problem I encountered is probably of less general use, but still it may be worth reporting it. On my web site, the URL of the "title" frame is dependent on that of the page in the "main" frame. So, "main.htm" would cause "maintitle.htm" to load, and "main2.htm" would bring up "maintitle".htm". This is done to cater for the use of three different organisational logo's in one web site.
I found that the only way to continue to enable this in combination with the 'fra-framed-med' scripting is to create an empty page called for example "emptytitle.htm" and to have the frameset in "frameset.htm" refer to that "emptytitle.htm". Then, as soon as "emptytitle.htm" is loaded, "main.htm" will cause the "title" frame to load "maintitle.htm" or, as the case may be, "main2.htm" will cause the "title" frame to load "maintitle2.htm". Without the otherwise useless initial loading of "emptytitle.htm" into the "title" frame, a main page may end up having the wrong title page displayed above it.
Perhaps there are others who have a title page for each main page as I do, and would benefit from this.
Other feedback on 'Re-directing access within frames - Revisited' - show all