我想知道是否有可能检测出iOS用户是否正在使用webapp,或者只是使用safari浏览器以正常方式访问。检测iOS是否正在使用webapp
我想实现的原因是,在iOS webapp上,当用户点击链接时,他将被重定向到Safari浏览器。所以我正在使用以下解决方法让他留在webapp中(防止切换到Safari浏览器)。
$(document).on("click",".nav ul li a",
function(event){
// Stop the default behavior of the browser, which
// is to change the URL of the page.
event.preventDefault();
// Manually change the location of the page to stay in
// "Standalone" mode and change the URL at the same time.
location.href = $(event.target).attr("href");
}
);
但我想这个解决方法只发生在用户使用webapp时,我希望它是有条件的webapp用户。所以不要在默认的Safari浏览器上。
尼斯和简单的答案!我搜索了c的stackoverflow,但由于某种原因该主题没有弹出。即使当我输入我的问题的标题时......谢谢! – koningdavid
我会的,只需要再等3分钟;) – koningdavid
@koningdavid:很高兴帮助你! –