Front-end technology -- browser compatibility problems caused by window. showModalDialog

Source: Internet
Author: User

Double-click domain implementation: http://blog.csdn.net/gaopeng0071/article/details/21179619,

In this blog post, double-click domain implementation is described, and browser compatibility problems are found in the window. showModalDialog modal box.

When chrome is used, the return value of the modal box cannot be returned to the parent page. This method is used: window. returnValue

  • From: http://blog.csdn.net/luckzhang_la/article/details/17262421

This method has browser compatibility issues. Browsers using the ie Kernel support this method, but browsers using the Google kernel (such as Chrome) do not.

The window. showModalDialog () method is not supported. Browsers using the Google kernel do not open a mode pop-up box but window. open (). In this way, set the return value window in the pop-up box. returnValue = "Return Value"; var vReturnValue = window when the parent form is obtained. showModalDialog (sURL [, vArguments] [, sFeatures]) found that vReturnValue is undefined.


The solution is as follows:

Parent page:

For more information, see Row 3 and row 3.

function ondbGuanLianADId(){adId = window.showModalDialog('getAdForMac.action', null ,'dialogHeight=500px; dialogWidth=420px;');var strs = adId;    if(strs==undefined){    strs=window.returnValue;    }if(strs != undefined){document.getElementById("guanLianADId").value = strs.split(":")[0];document.getElementById("guanLianADName").value = strs.split(":")[1];}}
Subpage:

Function test () {// solves the version difference between IE and chrome. if (window. opener! = Undefined) {// for chrome window. opener. returnValue = document. getElementById ("name1 "). value;} else {window. returnValue = document. getElementById ("name1 "). value;} window. close ();}


Reference resources: http://blog.csdn.net/luckzhang_la/article/details/17262421


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.