我想爲不同的android版本應用功能。我的代碼是:檢查如果Android版本<4.1與jquery
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(Android)/i);
if (agentID) {
var androidversion = parseFloat(agentID.slice(agentID.indexOf("Android")+8));
if (androidversion < 4.1)
{
alert(agentID + androidversion + 'I am older than JB');
newsblocks();
} else {
alert(agentID + androidversion + 'I am JB and up');
}
} else {
alert('I am not android');
}
但由於種種原因這個代碼不工作,無論Android版本讀取它,它表明「我是JB及以上」。你能幫我解決這個問題嗎?
非常感謝
你能不能用特徵檢測?爲什麼軟糖特別是? – SmokeyPHP
[通過Javascript/jQuery檢測Android手機]可能的重複(http://stackoverflow.com/questions/6031412/detect-android-phone-via-javascript-jquery) –
我有一個插件(swiper在屏幕上跳轉)在4.0.4上。它工作正常4.1雖然 – qqruza