[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: JS variables of another window
From:       Koos Vriezen <koos.vriezen () xs4all ! nl>
Date:       2002-02-05 1:16:26
[Download RAW message or body]

On Tue, 5 Feb 2002, David Faure wrote:
> On Monday 04 February 2002 20:03, Koos Vriezen wrote:
> > This next test case doesn't work right:
> >
> > <html><script>
> > function doIt () {
> >   alert (win.str);
> > }
> > var win = window.open ("apage.html", "w1", "width=200,height=200");
> > </script><body></body></html>
> >
> > where apage.html is:
> >
> > <html><head><script>
> > var str = "Hi";
> > </script></head>
> > <body onLoad='opener.doIt ()'></body></html>
> >
> > shows an alert box showing 'Undefined'.
>
> Took me quite some time to track down.
> The problem is that window.open is creating a JS interpreter for the new
> window, to return the window object... and KHTMLPart::begin() destroys this
> interpreter (since it calls clear()), so the var was put into another
> interpreter, created again later for the new window
> (read this 5 times at least ;)

Don't take this response seriously, I'm sleep walking now. But isn't the
call to KHTMLPart::begin() just too late. You suggest it's called after
'<html><head><script>var str = "Hi";' is interpreted.

Koos

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic