Jquery control parent window from child window

后端 未结 1 420
旧巷少年郎
旧巷少年郎 2021-01-14 12:43

I\'m playing around with a few ideas for a project, and one of them needs to somehow have communication between 2 different browser pages/windows/tabs. My goal is this:

相关标签:
1条回答
  • 2021-01-14 13:20

    Yes, actually that is possible. If you use window.open() in JavaScript, you can use window.opener. and submit whatever requests you would normally make. Like:

    window.opener.document.getElementById('id').innerHTML = "hello";

    or using jQuery,

    $(window.opener.document).find('#tableInParent').html("hello");

    Read more here: http://wisercoder.com/javascript-jquery-parent-windows/

    JSFIDDLE HERE

    I hope this helps!

    0 讨论(0)
提交回复
热议问题