[英]How do I determine the icon index for Desktop and Network for use in SHGetImageList?
[英]How do I determine if a device is a desktop browser?
我正在為網站創建響應式設計。 我們為非觸摸式桌面瀏覽器提供了一個過渡導航菜單,為觸摸移動和觸摸平板提供了非畫布菜單設計。 這是一個ASP.NET MVC4項目。 如果用戶使用台式機瀏覽器瀏覽網站,如何確定C#,Javascript或CSS3? 如果可能的話,我寧願使用某種CSS3媒體查詢。
在一個美麗的網站上: http : //www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
if(isMobile.any()){
// Mobile!
} else {
// It is desktop
}
其他使用諸如device.js的庫http://matthewhudson.me/projects/device.js/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.