Javscript bug in 'top' object

Karl Kuehn larkost at softhome.net
Wed Mar 14 11:41:44 PST 2001


	Slight change to the test html... looks like I pared it down a few characters too much for Netscape's preferences... sorry about that....

in the file 'base.html' change:
-------------------------------------
<frameset> 
-------------------------------------

to:
-------------------------------------
<frameset rows="*,">
-------------------------------------

	Karl Kuehn
		larkost at softhome.net
	
On Wednesday, March 14, 2001, at 01:31 PM, Karl Kuehn wrote:

> 	Sorry if this has been mentioned before, I just joined this list, and did not see anything 
> obvious in a quick overview of the archives. I have found an interesting bug in OmniWeb 
> 4b9's JavaScript DOM. Script written into web pages cannot see the 'top' object, but the 
> JavaScript console can! Here is a sample of this error: 
>  
> -------------------file: base.html-------------------- 
> <html> 
> <head> 
>         <title>nothing important</title> 
>         <script language="JavaScript"> 
>         <!-- 
>         myTestValue = " Yes it worked!"; 
>         //--> 
>         </script> 
> </head> 
> <frameset> 
>         <frame src="frame.html" /> 
> </frameset> 
> </html> 
> -------------------file: frame.html-------------------- 
> <html> 
> <head>    
>         <title>another something unimportant</title> 
> </head> 
> <body onLoad="alert('Did it work?' + top.myTestValue);"> 
>         A little text 
> </body> 
> </html> 
> ---------------------------------------------------------- 
>  
> 	What this should do is set a variable (top.myTestValue) that can be read from any frame 
> within the window, and then when the frame loads, you should get an alert window that says 
> "Did it work? Yes it worked!". But instead OmniWeb complains (in the JavaScript error log) 
> that 'top' is not a object ('[onload handler]:0: top has no properties'). 
> 	This setup works fine in Netscape, IE, and iCab, and conforms to the standards.. I think 
> this one counts as a bug. Oh.. and same behavior in OmniWeb 4b8 I have just realized (never 
> tracked down the error before). 
>  
> 	Karl Kuehn 
> 		larkost at softhome.net 
>  
> PS... I hope that later versions of OmniWeb will allow scripts to re-write frames... a 
> couple of my nicer scripts do that to limit bandwidth on downloads... 
>  



More information about the OmniWeb-l mailing list