Cookie processing in IE8 Browser

Source: Internet
Author: User

Cookie Processing
I have encountered the problem of IE8 processing cookies before, that is, using IE8 to log on to a website. Once I log on to the website, I need to log on to another page to publish the website. The problem is the login cookie information, which is not accepted by ie8. After reading this question on the Internet, many of my friends mentioned that when I log on to the Forum, I have to log on again. IE8 cannot read cookies. Finally, I checked the relevant documents of IE8 carefully. In this example, the security settings of IE8 are improved and only cookies with clear domain names are read.
It turns out to be a bad habit. Using cookies never explicitly sets domain names:
Cookie. set ('skin', 'Blue ', 365, '') // The question is here at the end''
Here, you should set the domain name for sending cookie information (cookie details [[url =] cookie in javascript [/url]), but before IE does not set the domain name, the default domain name is used to access the website. But now IE8 won't work. To be honest, add the domain name. By the way, paste the common cookie usage class:
Copy codeThe Code is as follows:
Var Cookie = {
IsAllowed: document. cookie & document. cookie! = '',
Set: function (cn, cv, d, dm ){
Var now = new Date ();
Var expire = new Date ();
If (d = null | d = 0 ){
D = 1;
}
Expire. setTime (now. getTime () + 3600000*24 * d );
Document. cookie = cn + '=' + encodeURI (cv) + '; expires =' + expire. toGMTString () + '; domain =' + dm + '; path = /';
},
Clear: function (cn, dm ){
If (this. get (name )){
Document. cookie = cn + '=' + (domain )? '; Domain =' + dm: '') + '; expires = Thu, 01-Jan-70 00:00:01 gmt ';
}
},
Get: function (cn ){
Var dc = document. cookie;
Var prefix = cn + '= ';
Var begin = dc. indexOf (';' + prefix );
If (begin =-1 ){
Begin = dc. indexOf (prefix );
If (begin! = 0 ){
Return null;
}
}
Else {
Begin + = 2;
}
Var end = document. cookie. indexOf (';', begin );
If (end =-1 ){
End = dc. length;
}
Return decodeURI (dc. substring (begin + prefix. length, end ));
}
};

Use of Opacity/filter transparent filter
Anyone who knows the lightbox effect knows that it is because of a translucent mask layer that adds a lot of NB to this effect. However, in IE8, the support for transparent filters is not so good. I even saw a foreign friend on google saying that IE8 is preparing to reject the transparent setting of elements, in addition to transparent images. I think the cool and transparent effect in IE8 has become a pain point in your mind when you start a similar program. But don't worry. I can still use this effect in beta2. You just need to do this:
Copy codeThe Code is as follows:
Function Opacity (element, value ){
Var style = element. style;
Style. opacity = value/100;
Style. filter = "alpha (opacity =" + value + ")";
}

Just three lines of code. Haha, you don't need to do browser sniffing like in many JS libraries. I tested it, IE6 ~ 8 (Standard IE8 view), opera 9 +, NetScape8.1, FF2.x ~ The 3. x and goolge browsers all support well. It is to pay attention to the order, you must first use opacity, and then use filter to ensure that it can be properly displayed. Very good, very simple! Well, let's talk about this today!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.