🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #71

Re: HELP!!! IE vs Net-Nav

#71
From: peter baaij
Date: Tue, 14 Sep 1999 00:00
61 lines
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
Technical Details
Message-ID: <37DE5579.7AE1B0D5@casema.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <rtsg3eiu1iv66@corp.supernews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10731d,f2ebdcc97eccb2bd
X-Google-Attributes: gid10731d,public
X-Google-Thread: fb3cb,f2ebdcc97eccb2bd
X-Google-Attributes: gidfb3cb,public
From: peter baaij <xoc@casema.net>
Subject: Re: HELP!!! IE vs Net-Nav
Date: 1999/09/14
Message-ID: <37DE5579.7AE1B0D5@casema.net>
X-Deja-AN: 524979886
Content-Transfer-Encoding: 7bit
References: <rtsg3eiu1iv66@corp.supernews.com>
X-Accept-Language: en
X-Server-Date: 14 Sep 1999 14:02:37 GMT
Content-Type: text/plain; charset=us-ascii
X-Abuse-Info: Otherwise we will be unable to process your complaint properly 
X-Complaints-To: abuse@casema.net 
X-Trace: reader1.casema.net 937317757 29811 195.96.98.140
MIME-Version: 1.0
Newsgroups: comp.lang.javascript,borland.public.intrabuilder.javascript