本文介紹了jQuery/Javascript 在沒(méi)有插件的情況下檢測(cè)操作系統(tǒng)?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
限時(shí)送ChatGPT賬號(hào)..
我正在尋找一種方法來(lái)檢測(cè)下載頁(yè)面的操作系統(tǒng),使用 jQuery 或 Javascript 來(lái)推薦適用于 Mac 和 Windows 的特定文件.我希望在不向我的頁(yè)面添加另一個(gè)插件的情況下做到這一點(diǎn).
I am looking for a way to detect the OS for a downloads page using jQuery or Javascript to recommend specific files for Mac vs Windows. I was hoping to do it without adding another plugin to my page.
推薦答案
試試:
var os = navigator.platform;
然后根據(jù)結(jié)果相應(yīng)地處理 os 變量.
Then handle the os variable accordingly for your result.
您還可以遍歷 navigator
對(duì)象的每個(gè)對(duì)象,以幫助您更熟悉這些對(duì)象:
You can also loop through each object of the navigator
object to help get you more familiarized with the objects:
<script type="text/javascript">
for(var i in navigator){
console.log(i+"="+navigator[i]+'<br>');
}
</script>
這篇關(guān)于jQuery/Javascript 在沒(méi)有插件的情況下檢測(cè)操作系統(tǒng)?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!