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

点点圈 提交于 2019-12-10 21:58:00

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/11827158/ipad-safari-browser-does-not-support-the-window-open-javascript-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!