2011-11-25 30 views
0

我有一個web應用程序,它分配給用戶主屏幕(ios)時看起來不錯,但從safari去它時不太好。有沒有一種方法可以控制只有從Safari瀏覽器訪問webapp時運行哪些腳本/項目?然後從主屏幕啓動時運行一個腳本/代碼?html5移動webapp添加到主屏幕問題

回答

0

我假設從主屏幕鏈接啓動時,網頁設置爲不使用地址欄等。並且您想要檢測何時不以這種方式啓動(以糾正較小的垂直空間等)

然後,您要檢測的是「應用模式」或「獨立模式」。 This site seems to explain quite well how to detect it

(在此情況下,鏈路在未來管芯)在本質上是測試

if (("standalone" in window.navigator) && !window.navigator.standalone){ 
    // Not standalone/fullscreen here (visiting from safari) 
}else{ 
    //Fullscreen mode (launched from homescreen) 
}