ShowModalDialog in Google Browser will return null solution _javascript Tips

Source: Internet
Author: User
The return value of the ShowModalDialog is available under IE and Firefox, but it returns null below Google Browser, and the following are the solutions

Parent page:
Copy Code code as follows:

function OpenWindows () {
var obj = new Object ();

Open the modal subform and get the return value
var retval = window.showModalDialog ("ordervideo.jsp?rderids=" + "0010,0020,0030", obj, "dialogwidth=500px; dialogheight=500px ");

For Chrome
if (retval = = undefined) {
retval = Window.returnvalue;
}
alert (retval);
}

Sub page:
Copy Code code as follows:

function onload () {

//for chrome
if (Window.opener!= d) {//window.opener's value is not empty under Google Browser, ie/Firefox is not defined below, which determines whether Google browser
Window.opener.returnValue = flag; Google browser to the return value of the method of assigning value window.opener.close (); This must be turned off once, otherwise the following window.close () cannot close the pop-up window because the pop-up window under Google Browser is a new window
}

Else {
Window.returnvalue=flag; This method of assignment is compatible with ie/Firefox, but does not support Google browser
}
Window.close ();

}

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.