Operation cookie. Determine the browser system version, determine the safir browser to store data, cookiesafir
Var Safir = {
GetLocalStorage: function (key ){
Var storage = window. localStorage;
If (storage. getItem (key )){
Var l = storage. getItem (key );
Return l;
} Else {
Return "0 ";
}
},
DeleteSessionStorage: function (key ){
Var f = "0 ";
Storage = window. sessionStorage;
Try {
Storage. removeItem (key );
F = "1 ";
} Catch (error ){
F = "2 ";
}
Return f;
},
DeleteLocalStorage: function (key ){
Var f = "0 ";
Storage = window. localStorage;
Try {
Storage. removeItem (key );
F = "1 ";
} Catch (error ){
F = "2 ";
}
Return f;
},
IsSessionStorage: function (key ){
Var f = false;
Storage = window. sessionStorage;
Try {
Storage. setItem (key, key );
Storage. removeItem (key );
F = true;
} Catch (error ){
F = false;
}
Return f;
},
AddLocalStorage: function (key ){
Var f = "0 ";
Storage = window. localStorage;
Try {
Storage. removeItem (key );
Storage. setItem (key, key );
F = "1 ";
} Catch (error ){
F = "2 ";
}
Return f;
},
AddLocalStorage: function (key, value ){
Var f = "0 ";
Storage = window. localStorage;
Try {
Storage. removeItem (key );
Storage. setItem (key, value );
F = value;
} Catch (error ){
F = "2 ";
}
Return f;
},
AddSessionStorage: function (key ){
Var f = "0 ";
Storage = window. sessionStorage;
Try {
Storage. removeItem (key );
Storage. setItem (key, key );
F = "1 ";
} Catch (error ){
F = "2 ";
}
Return f;
},
AddSessionStorage: function (key, value ){
Var f = "0 ";
Storage = window. sessionStorage;
Try {
Storage. removeItem (key );
Storage. setItem (key, value );
F = value;
} Catch (error ){
F = "2 ";
}
Return f;
}
}
Var Phone = {
Versions: function (){
Var u = navigator. userAgent, app = navigator. appVersion;
Return {
Mobile :!! U. match (/AppleWebKit. * Mobile. */), // whether it is a Mobile terminal
Ios :!! U. match (/\ (I [^;] +; (U ;)? CPU. + Mac OS X/), // ios Terminal
Android: u. indexOf ('android')>-1, // Android Terminal
IPhone: u. indexOf ('iphone ')>-1, // whether the iPhone is
IPad: u. indexOf ('ipad ')>-1, // whether iPad
WebKit: u. indexOf ('applewebkit')>-1, // Apple, Google Kernel
QQBrowser: u. indexOf ('qqbrowser ')>-1,
QQ: u. indexOf ('qq')>-1,
Wechat: function (){
If (u. match (/MicroMessenger/I) = 'micromessenger ')
{Return true ;}
Else {return false ;}
}()
};
}()
}
Var cookie = {
AddCookie: function (key, value, time ){
$. Cookie (key, value, {expires: 1, path: '/', domain: '.neihanhongbao.com', secure: false, raw: false });
},
GetCookie: function (key ){
Return $. cookie (key );
},
DelCookie: function (key ){
$. Cookie (key, '', {expires:-1 });
},
CheckCookie: function (key ){
Var f = "0 ";
If ($. cookie (key) = undefined | $. cookie (key) = ""){
F = "1 ";
}
Else {
F = "2 ";
}
Return f;
}
}