我想知道是否有可能檢測出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:很高興幫助你! –