IPAD safari浏览器不支持window.open JavaScript方法 [英] IPAD safari browser does not support the window.open JavaScript method

查看:2412
本文介绍了IPAD safari浏览器不支持window.open JavaScript方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPad上的JavaScript代码中调用 window.open 方法。当我调用该方法时,它工作正常。现在我想从HTML页面返回一个值,该页面由 window.load 方法打开。它在其他浏览器中返回值,但它没有在iPad Safari浏览器中返回值。

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.

推荐答案

与大多数浏览器不同, iPad上Safari中的标签无法相互通信。您应该重新考虑您的界面以避免使用window.open(如果可以),而是使用基于HTML的对话框在页面中打开弹出窗口。像jQuery-UI对话框或类似的代码。

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.

编辑:jQuery-UI对话框示例

jQuery-UI Dialog example

使用对话框中你需要一个HTML元素,它为隐藏的对话框标记提供一个区域:

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>

然后你将使用jQuery调用这个对话框:

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();

参见此处的文档了解更多详情。

这篇关于IPAD safari浏览器不支持window.open JavaScript方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆