开发者

Adding variables to the global window object in IE

开发者 https://www.devze.com 2023-03-25 06:44 出处:网络
I have a situation where a link opens a new window(child) using Javascript. I am trying to pass a variable to the child window fo开发者_如何学Gorm the parent window by attaching to the new window\'s w

I have a situation where a link opens a new window(child) using Javascript. I am trying to pass a variable to the child window fo开发者_如何学Gorm the parent window by attaching to the new window's window object.

In the parent:

var wnd = open(file, name, attribs);
wnd.a = 10;

In the child when I do

window.a;

IE says undefined. This works on Chrome, Firefox and Safari.

Where am I going wrong?


Wait until the new window has loaded before setting the variable on its window object. In IE you may need to handle the load event within the new window rather than the main window.

0

精彩评论

暂无评论...
验证码 换一张
取 消