Javascript cross window interaction

蹲街弑〆低调 提交于 2019-12-01 12:36:33

Ok, I wrote you a sample you can check at http://jsfiddle.net/zzdAL/

$(document).ready(function()
                  {
                      popup = window.open("http://fiddle.jshell.net");
                      $("#input1").click(function() {
                          try {
                                popup.document.window.alert(1);
                          }
                          catch (e) { alert(e.message); }
                      });
                  }
                 );

It only runs an alert on the popup, but you can do whatever you want with the popup, assuming you have the necessary rights (needs to be the same domain I believe).

The most simple is to write a function in your popup and call it from the opener.

Probably it's too late, but here is an example of interaction: window interaction

Take a look to greasemonkey, it's an addon for your browser. You can choose on which page(s) the script will works.

http://wiki.greasespot.net/Main_Page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!