移动端web前端的那些坑
Posted 泠泠在路上
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了移动端web前端的那些坑相关的知识,希望对你有一定的参考价值。
转自:https://blog.csdn.net/u013022210/article/details/51312255
转自:https://blog.csdn.net/web_wyj/article/details/81738792
ios无痕浏览器不识别localStorage并报错的解决办法:
try
localStorage.setItem('isPrivateMode', '1');
localStorage.removeItem('isPrivateMode');
window.isPrivateMode = false;
catch(e)
window.isPrivateMode = true;
if (!window.isPrivateMode && window.localStorage)
localStorage.removeItem('namegtcrem');
localStorage.setItem('namegtcrem',username);
localStorage.removeItem('passwordgtcrem');
localStorage.setItem('passwordgtcrem',password);
else
try
var cookies = function();
cookies.prototype =
setCookie:function(c_name, value, expiredays)
var exdate=new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
,
getCookie:function(name)
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return (arr[2]);
else
return null;
,
delCookie:function(name)
var cookie = new cookies();
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=cookie.getCookie(name);
if(cval!=null)
document.cookie= name + "="+cval+";expires="+exp.toGMTString();
var cookie = new cookies();
cookie.delCookie('namegtcrem');
cookie.delCookie('passwordgtcrem');
cookie.setCookie('namegtcrem', username, 30);
cookie.setCookie('passwordgtcrem', password, 30);
catch (e)
alert(e);
以上是关于移动端web前端的那些坑的主要内容,如果未能解决你的问题,请参考以下文章