zoukankan      html  css  js  c++  java
  • 操作cookie.判断浏览器系统版本,判断safir浏览器存储数据

    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.*/), //是否为移动终端
    ios: !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
    android: u.indexOf('Android') > -1, //android终端
    iPhone: u.indexOf('iPhone') > -1, //是否为iPhone
    iPad: u.indexOf('iPad') > -1, //是否iPad
    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
    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;
    }
    }

  • 相关阅读:
    基于Linux C的socketEthereal程序和Package分析 (一个)
    [Firebase + PWA] Keynote: Progressive Web Apps on Firebase
    [Redux] Navigating with React Router <Link>
    [Redux] Adding React Router to the Project
    [Redux] Refactoring the Entry Point
    [Redux] Persisting the State to the Local Storage
    [Redux] Supplying the Initial State
    [PWA] Caching with Progressive libraries
    [TypeScript] Understanding Generics with RxJS
    [React + Mobx] Mobx and React intro: syncing the UI with the app state using observable and observer
  • 原文地址:https://www.cnblogs.com/1003487863qq/p/5872283.html
Copyright © 2011-2022 走看看