Subj : Re: Javascript Exception using "window.location.host" To : nzgrover From : Brendan Eich Date : Sun Sep 05 2004 10:47 pm nzgrover wrote: > Hi, Wrong newsgroup -- see headers. /be > Using "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) > Gecko/20040616" > on "Windows XP Pro V2002 SP1" > > I'm dynamically creating the page contents of a frame using: > src='javascript:parent.opener.aJavascriptFunction'> > This function creates the HTML document for the frame using a mixture > of document.write() and DOM methods (don't ask...). > > Calling "window.location" in a onload script in the generated page > returns: "javascript:parent.opener.aJavascriptFunction". (The same as > under IE6). Calling "window.location.host" produces the following in > the javascript console: > > Error: uncaught exception: [Exception... "Component returned failure > code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.host]" nsresult: > "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: > javascript:parent.opener.aJavascriptFunction :: init :: line 1" data: > no] > > IE 6 returns "parent.opener.aJavascriptFunction" > Further more, mozilla is unable to resolve relative URLs in the > created document. That is, i had a link to a CSS file which was in the > same directory as the frameset document: > > This worked fine under IE6 but not at all under Mozilla. Note that I > also tried a element in the element, this also worked > fine under IE6 but not under Mozilla. > However, if i put in an absolute URL in like: > > This worked fine in both browsers. > > Anybody have any work arounds for this? i'd like to be able to use > relative URL's. .