1.IE Conditional Comment
Introduction to Conditional annotations
The conditional annotation in IE (Conditional comments) has excellent distinguishing ability to IE's version and IE non ie, it is the hack method commonly used in web design.
Conditional annotations can only be used for IE5 above, IE10 not supported.
If you install more than one IE, the conditional comment will be the highest version of IE as standard.
The basic structure of the conditional comment is the same as the HTML comment (<!––>). Browsers outside of IE will therefore treat them as plain annotations and ignore them entirely.
IE will determine whether the content in the conditional comment is parsed as if the normal page content is parsed, based on the IF condition.
Example of how conditional annotations are used
<!–[if IE 5]>Only IE5.5 visible<![endif]–><!–[if GT IE 5.5]>Only IE 5.5 above visible<![endif]–><!–[if lt IE 5.5]>Only IE 5.5 below visible<![endif]–><!–[if GTE IE 5.5]>IE 5.5 and above visible<![endif]–><!–[if LTE IE 5.5]>IE 5.5 and below are visible<![endif]–><!–[if! IE 5.5]>ie visible in non IE 5.5<![endif]–>
Excerpt Link: http://segmentfault.com/blog/liangyi/1190000002409131
2.html code dynamically loaded into the page with JS
<type= "text/html" ID= "t-pclist">// here is the HTML code you want to put, such as the content of a div </ Script >
Add the above JS dynamic to the page
$ (function() {var s=$ ("#T-pclist"). html (); get the HTML content of JS $ (". Picscroll-left. BD"). HTML (s); // The content of S is placed in the BD Thisstyle (); // Execute a function });
3.js determine whether a user is accessing a PC or mobile
varBrowser={versions:function(){ varU = navigator.useragent, app =navigator.appversion; varSuseragent =navigator.useragent; return{trident:u.indexof (' Trident ') >-1, Presto:u.indexof (' Presto ') >-1, Ischrome:u.indexof ("Chrome") >-1, Issafari:!u.indexof ("Chrome") >-1 && (/webkit|khtml/). Test (U), IsSafari3:!u.indexof ("Chrome") >-1 && (/webkit|khtml/). Test (U) && u.indexof (' WEBKIT/5 ')! =-1, Webkit:u.indexof (' AppleWebKit ') >-1, Gecko:u.indexof (' Gecko ') >-1 && u.indexof (' khtml ') = =-1, Mobile:!! U.match (/applewebkit.*mobile.*/), iOS:!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/), Android:u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1, Iphone:u.indexof (' IPhone ') >-1, Ipad:u.indexof (' IPad ') >-1, Iwinphone:u.indexof (' Windows Phone ') >-1 }; }()}if(Browser.versions.mobile | |Browser.versions.iWinPhone) {window.location= "http:/www.baidu.com/m/";}
4.js how to tell if a user is using a browser
Determine if the browser is built-in based on the keyword Micromessenger. The judging function is as follows:
function isweixin () { var ua = window.navigator.userAgent.toLowerCase (); if (Ua.match (/micromessenger/i) = = ' Micromessenger ') {returntrue; } Else { returnfalse;
See the Rainbow after the rain
Source: http://www.cnblogs.com/moqiutao/
If you feel that this article is helpful to your study, please support and encourage more.
Js/jquery/html Front-end development common to fragment code (always updated)