Aro*_*ost 36 javascript web-applications mobile-safari ios iphone-standalone-web-app
window.open()在iOS网络应用程序中调用时,该页面将在Web应用程序中打开而不是移动Safari.
如何强制在移动野生动物园中打开网页?
注意:使用直接<a href>链接不是一种选择.
zvo*_*ona 63
这个有可能.使用iOS5独立Web应用程序进行测试:
HTML:
<div id="foz" data-href="http://www.google.fi">Google</div>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
document.getElementById("foz").addEventListener("click", function(evt) {
var a = document.createElement('a');
a.setAttribute("href", this.getAttribute("data-href"));
a.setAttribute("target", "_blank");
var dispatch = document.createEvent("HTMLEvents");
dispatch.initEvent("click", true, true);
a.dispatchEvent(dispatch);
}, false);
Run Code Online (Sandbox Code Playgroud)
可以在这里测试:http://www.hakoniemi.net/labs/linkkitesti.html
原来它是不是可能的逃跑与一个JavaScript iOS的Web应用程序window.open().如果您想要在移动版Safari中打开链接,则必须使用<a href>链接.
| 归档时间: |
|
| 查看次数: |
44776 次 |
| 最近记录: |