(function(w) {
var pcm = readCookie('pcm');
//var ua
= w.navigator.userAgent;
var ua
= w.navigator.userAgent.toLocaleLowerCase();
var url = 'http://m.pincai360.com/';
var matchedRE = /iphone|android|symbianos|windows\sphone/g;
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1, c.length)
}
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length, c.length)
}
}
return null
}
if ( matchedRE.test(ua) && pcm != '1' ) {
w.location.href = url;
}
})(window);
//设置cookie
function setCookie(name, value, expires, path, domain, secure) {
var cookieName = encodeURIComponent(name) + '=' + encodeURIComponent(value);
if (expires instanceof Date) {
cookieName += '; expires=' + expires;
}
if (path) {
cookieName += '; path=' + path;
}
if (domain) {
cookieName += '; domain=' + domain;
}
if (secure) {
cookieName += '; secure';
}
document.cookie = cookieName;
}
function _cookies(){
setCookie('pcm', '1', 1,'','.pincai360.com',false);
window.location.href = '//www.pincai360.com/#m';
}