简体   繁体   English

IPAD safari浏览器不支持window.open JavaScript方法

[英]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. 我想在iPad上的JavaScript代码中调用window.open方法。 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. 现在我想从window.load方法打开的HTML页面返回一个值。 It returns values in other browsers, but it is not returning a value in the iPad Safari browser. 它在其他浏览器中返回值,但它不会在iPad Safari浏览器中返回值。

Unlike most browsers, the tabs in Safari on the iPad can't communicate with each other. 与大多数浏览器不同,iPad上Safari中的选项卡无法相互通信。 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. 您应该重新考虑您的界面以避免使用window.open(如果可以),而是使用基于HTML的对话框在页面中打开弹出窗口。 Something like jQuery-UI dialog or similar code. 像jQuery-UI对话框或类似的代码。

EDIT: jQuery-UI Dialog example 编辑:jQuery-UI对话框示例

To use the dialog you'll need an element in your HTML that provides an area for the hidden dialog markup: 要使用该对话框,您需要HTML中的一个元素,该元素为隐藏的对话框标记提供一个区域:

<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: 然后你将使用jQuery这样调用这个对话框:

$('#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. 有关详细信息,请参阅此处文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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