open a new window, and call javascript function - Stack Overflow

I am new to javascript. I would like to know how a new window can be opened from a javascript method, a

I am new to javascript. I would like to know how a new window can be opened from a javascript method, and then call it's javascript methods.

The url of the window, is in another domain (can cause a security problem !?), and I don't have control over it.

For example, a code that should behave as the followings:

handler<-openAWindow("www.someurl");//open a window and get a handler for it
handler->someMethod1(param1, param2);//call some javascript method 
handler->someMethod2(param3, param4);//call some other javascript method<br>

Thanks,
Eran.

I am new to javascript. I would like to know how a new window can be opened from a javascript method, and then call it's javascript methods.

The url of the window, is in another domain (can cause a security problem !?), and I don't have control over it.

For example, a code that should behave as the followings:

handler<-openAWindow("www.someurl.");//open a window and get a handler for it
handler->someMethod1(param1, param2);//call some javascript method 
handler->someMethod2(param3, param4);//call some other javascript method<br>

Thanks,
Eran.

Share Improve this question edited Sep 22, 2010 at 18:43 Sharjeel Aziz 8,5355 gold badges40 silver badges37 bronze badges asked Sep 22, 2010 at 18:36 user455416user455416 911 gold badge1 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 17

You cannot control or access a cross domain window unfortunately. This is done for security precautions. Do you have control over the other URL?

However, if the window is on the same domain you do have access to the window and its DOM.

var win = window.open("/page", "title");
win.someFunction();
var el = win.document.getElementById("id123");
//etc.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743323725a4462498.html

相关推荐

  • open a new window, and call javascript function - Stack Overflow

    I am new to javascript. I would like to know how a new window can be opened from a javascript method, a

    2天前
    200

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信