2015-09-02 62 views
1

我在工作的移動責任網站。我正在使用自己的應用程序來顯示我的網站。如何使用PHP,Jquery或任何API獲取Android App ID或名稱?

如何檢查用戶打開的網站使用我的應用程序或其他應用程序(如:鉻,火狐)。

+1

發送使用你的應用程序的自定義用戶代理(或任何其他頭)。 – vonUbisch

+0

我不知道使用在線應用程序創建者網站的android生成應用程序。 –

+0

我都沒有,但是你應該用'android'或者同等的東西來更新你的標籤。 – vonUbisch

回答

2

假設您可能想通過ducktyping來檢測用戶代理以進行Web瀏覽器檢測。這可以使用Javascript完成。

更新:

var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; 
    // Opera 8.0+ (UA detection to detect Blink/v8-powered Opera) 
var isFirefox = typeof InstallTrigger !== 'undefined'; 
    // Firefox 1.0+ 
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; 
    // At least Safari 3+: "[object HTMLElementConstructor]" 
var isChrome = !!window.chrome && !isOpera;    // Chrome 1+ 
var isIE = /*@[email protected]*/false || !!document.documentMode; // At least IE6 

var output; 
output += 'isFirefox: ' + isFirefox + '\n'; 
output += 'isChrome: ' + isChrome + '\n'; 
output += 'isSafari: ' + isSafari + '\n'; 
output += 'isOpera: ' + isOpera + '\n'; 
output += 'isIE: ' + isIE + '\n'; 
console.log(output); 

這裏是reference link of the answer provided by Rob W.

+1

嘗試Useragent,但它返回'Mozilla/5.0(Windows NT 6.1; WOW64)AppleWebKit/537.36(KHTML,像Gecko)Chrome/44.0.2403.157 Safari/537.36' –

+0

好的。更新答案。你可能想要尋找鴨子的網頁瀏覽器檢測。 – Daenarys

+1

感謝它的運作良好。 –

相關問題