Thread View: comp.lang.javascript
2 messages
2 total messages
Started by Mike
Tue, 14 Sep 1999 00:00
HELP!!! IE vs Net-Nav
Author: Mike
Date: Tue, 14 Sep 1999 00:00
Date: Tue, 14 Sep 1999 00:00
33 lines
1648 bytes
1648 bytes
Hi, I've got a Web page with frames like this... (you should see the picture using the Times New Roman font) __________________________ | top | |_________________________| | cont- | | | -ents | | | | main | | | | |_____|____________________| I've got a director movie in <contents> which loads pages into <top>. There a script in every page which is loaded into <top> which loads a page into <main>. The code is as follows: <script language="JavaScript"> <!-- parent.main.location.href="my_main_page.htm"; --> </script> This all works fine in IE, but not in Netscape (version 4.6). I'm really struggling with this, and I would really appreciate any help from anyone, even if you think you're talking nonsense!!! Thanks very much, --- Mike ---
Re: HELP!!! IE vs Net-Nav
Author: peter baaij
Date: Tue, 14 Sep 1999 00:00
Date: Tue, 14 Sep 1999 00:00
61 lines
3362 bytes
3362 bytes
I know of this problem, here is how i tried to explain it in an onther posting
(this was about changing images in other frames - basically it's the same
problem):
>>>>Pasting the posting:
Well, this is one of these things that would drive you mad. I encoutered the
same problem a few years ago. But i still having nightmares because off it. It
is one of the
reasons why i dislike some products and some companies.
First i like to state that if you wouldn't use directories, but just one
folder, offcourse you wouldn't have this problem. Also, if you do use
directories, and give full
blown URL's for changing locations (URL, SRC), there is no problem. (But,
offcourse, if you have a complex site you want directories, and you want to use
relative
URL, as you want to test your site offline.)
What is the actual problem then? That is: what is a relative URL relative to.
Let's say we have index.html in the root. It represents a frameset with two
frames: frame1 containing document1.html, and frame2 containing document2.html.
In the same root there is a folder called somepages, containing the documents
document1.html and document2.html.
We also have a second folder that is called images, which contains image.gif
and otherimage.gif.
Let's say image.gif appears in document1.html on default, and you would like to
replace it by otherimage.gif by means of javascript, using a relative URL. The
script is called from document2.html.
In Netscape the code should be:
parent.frame1.document.images[0].src = "../images/otherimage.gif";
(You should know that ../ means go one up in the directorystructure)
In Explorer the code should be:
parent.frame1.document.images[0].src = "images/otherimage.gif";
This means that Netscape is interpreting the URL relative to the document.
Hence, we have to move one up (../) before entering the folder images.
Explorer came with an other interpretation. It says the URL should be relative
to the frameset, that is to the document index.html that is in the root. In
this
interpretation the move one up is offcourse false and ../ should be left away.
Solution for this is to make a filter:
--------
var browser = navigator.appName
if(browser.indexOf("Micros") != -1){
var strange = "";
}
else{
var strange = "../";
}
parent.frame1.document.images[0].src = strange + "images/otherimage.gif";
----------
Isn't all off this strange....
>>>>>>End of posting
Hope this will help you,
Peter Baaij
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads