标签:
一 判断移动终端类型
1. 判断是否是IE浏览系统
isIE: function() { return (/msie/i).test(navigator.userAgent); }
2. 判断是否是Android浏览系统
isAndroid: function() { var isAndroid = false, androidVersion; if(navigator.userAgent.indexOf("Android") >= 0 ) { androidVersion = parseFloat(navigator.userAgent.slice(navigator.userAgent.indexOf("Android")+8)); if (androidVersion <= 2.4) { isAndroid = true; } } return isAndroid; }
3. 判断是否是Windows Phone 7浏览系统
fontFaceCheck: function() { if (/Windows Phone OS 7/.test(navigator.userAgent)) { Modernizr.fontface = false; $("html").removeClass("fontface").addClass("no-fontface"); } }
二 URL Params
/* * URL Params - v1.0 - 8/28/2013 * http://pastebin.com/yvfeK76y * * Include this in the document <head> for best results. It will create a global * object "urlParams" that stores all querystring parameters in a URL. * * Uses/examples: * if ("foo" in urlParams) { ... } * var foo_value = urlParams["foo"]; * */ var urlParams = {}; (function() { var e, a = /\+/g, r = /([^&=]+)=?([^&]*)/g, d = function(s) { return decodeURIComponent(s.replace(a, " ")); }, q = window.location.search.substring(1); while (e = r.exec(q)) urlParams[d(e[1])] = d(e[2]); })();
标签:
原文地址:http://www.cnblogs.com/wangshuo1/p/4341561.html