简体   繁体   中英

IPAD safari browser does not support the window.open JavaScript method

I want to call the window.open method in JavaScript code on an iPad. When I call that method, it works fine. Now I want to return a value from the HTML page which is opened by the window.load method. It returns values in other browsers, but it is not returning a value in the iPad Safari browser.

Unlike most browsers, the tabs in Safari on the iPad can't communicate with each other. You should rethink your interface to avoid window.open if you can and instead use an HTML-based dialog that opens a popup within your page. Something like jQuery-UI dialog or similar code.

EDIT: jQuery-UI Dialog example

To use the dialog you'll need an element in your HTML that provides an area for the hidden dialog markup:

<div id="dialog">This could have a preset message or you can override it.</div>

Then you will call this dialog using jQuery like this:

$('#dialog').dialog();

If you want to change the contents of the dialog first do:

$('#dialog').html('<p>Some html content.</p>');
$('#dialog').dialog();

See the documentation here for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM