How does javascript-js call js across windows?

Source: Internet
Author: User
For example, qq login (qzonestyle.gtimg.cnqzoneopenapijs-sdk-demo.html), click the qq login button on the page. The new qq logon window B is displayed. After the mobile phone is scanned, the B window is closed and the retFun function in. How is this done? Such as QQ login (http://qzonestyle.gtimg.cn/qzone/openapi/js-sdk-demo.html), in A page Click qq login button, pop up new qq login window B, mobile phone scan after login, B window closed, and call the retFun function in window.

How is this done?

Reply content:

Such as QQ login (http://qzonestyle.gtimg.cn/qzone/openapi/js-sdk-demo.html), in A page Click qq login button, pop up new qq login window B, mobile phone scan after login, B window closed, and call the retFun function in window.

How is this done?

Window A opens window B, so window B haswindow.opener(Window. open or href opens, and IE only opens through window. open) points to window.

A

// Window. open (B); // open window B function test () {alert (1 );}

B

window.onbeforeunload = function() {  if (window.opener) {    window.opener.test();  }}

Note: The server environment is required.

For more information about cross-window/Document Communication exceptions, seepostMessageInformation

For how to scan the QR code to log on to the webpage, see scan the QR code. How do you contact the two events?

This must be A notified by the server and called by A. As for how the server notifies A, there are A lot of technologies. Just check it. It is certainly not the called in the B window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.