Determine if the access end is a mobile device and redirect to the mobile interface if it is a mobile device.
var uri = location.href; var domainwap = "http://m.vmall.com"; if (uri = = Domainmain | | uri = = (Domainmain + "/index.html") | | uri = = (Domainmain + "/")) { // If the client is a mobile device, you can also tell what browser Chrome,firefox,ie
Redirect to the mobile interface if it's a mobile device
if (/android|webos|iphone|ipad|ipod| Blackberry/i.test (navigator.useragent)) { window.location.href = domainwap;
}
}
//reads the key specified in the cookie and processes the valuecookieget=function(a) {varf=NULL; if(document.cookie&&document.cookie!= ""){ varD=document.cookie.split (";"); for(varC=0;c<d.length;c++){ //Remove the space from the key in the cookie varb= (d[c]| | ""). Replace (/^ (\s|\u00a0) +| ( \S|\U00A0) +$/g, ""); if(b.substring (0,a.length+1) = = (A + "=")){ varE=function(i) {i=i.replace (/\+/g, ""); varH= ' () <>@,;:\ \ "/[]?={} '; //If I contains characters in H, remove the front and back " for(varg=0;g){ if(I.indexof (H.charat (g))!=-1){ if(I.startwith (' "')) {i=i.substring (1)} if(I.endwith (' "')) {i=i.substring (0,i.length-1)} Break; } } //decodes a URI, decodes a string into a URL returndecodeuricomponent (i)}; F=e (B.substring (a.length+1)); Break; } } } returnF};
var b = "http%3a%2f%2fwww.vmall.com%2faccount%2fcaslogin%3furl%3d"; var c = "http://cart.vmall.com/cart/cart.html?" ; Alert (decodeURIComponent (b)); //decode: http://www.vmall.com/Faccount/caslogin?url= Alert (encodeURIComponent (c)); //code: http%3a%2f%2fcart.vmall.com%2fcart%2fcart.html%3f
Determine if the access end is a mobile device