[英]How to prevent iPhone web app links from opening in Safari?
I have a web app that I contains links to several pages. 我有一个网络应用程序,其中包含指向多个页面的链接。 I am using jQuery Mobile framework.
我正在使用jQuery Mobile框架。 However, when I click a link, it opens the page in Safari and not in the web app.
但是,当我单击链接时,它将在Safari中而不是在Web应用程序中打开页面。
Here is my javascript code that I link to in the page with the links: 这是我在页面中使用链接链接到的JavaScript代码:
$( document ).on (
"click",
"a",
function( event ) {
event.preventDefault();
location.href = $( event.target ).attr ( "href" );
}
);
Is it outdated now or am I missing something? 现在过时了还是我错过了什么?
$(document).delegate("a", "vclick click", function(event) {
$.mobile.defaultPageTransition = "slide";
var href = $(this).attr("href");
event.preventDefault();
if ( event === "click" ) { return; }
$.mobile.changePage(href);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.