473,473 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Ckeck if cookies are enables in IE? (works in Firefox)

Hi.

I create this function to verify if cookies are enables in the
browser.

<script type="text/javascript" language="JavaScript">
document.cookie = "TemporaryTestCookie=yes;";
if(document.cookie.indexOf("TemporaryTestCookie=") == -1) {
alert("Atention: You have to set cookies on.");
}
</script>

This function works well in Firefox, but dont work im Microsoft
Internet Explorer 6.

Why? I dont undestand why!

Can anyone helpme? Thanks.

Jun 20 '06 #1
2 1705
Hi,

Apaxe2000 wrote:
Hi.

I create this function to verify if cookies are enables in the
browser.

<script type="text/javascript" language="JavaScript">
document.cookie = "TemporaryTestCookie=yes;";
if(document.cookie.indexOf("TemporaryTestCookie=") == -1) {
alert("Atention: You have to set cookies on.");
}
</script>

This function works well in Firefox, but dont work im Microsoft
Internet Explorer 6.

Why? I dont undestand why!

Can anyone helpme? Thanks.


I am not totally sure why it doesn't work in IE (no time for extensive
checks, sorry), my guess is that it has to do with the path.

Anyway, check this page. I published my cookie object recently, and it
offers methods doing exactly what you want. Check the code and feel free
to use it.
http://www.galasoft-lb.ch/myjavascri...kie/index.html

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 21 '06 #2

Apaxe2000 написав:
Hi.

I create this function to verify if cookies are enables in the
browser.

<script type="text/javascript" language="JavaScript">
document.cookie = "TemporaryTestCookie=yes;";
if(document.cookie.indexOf("TemporaryTestCookie=") == -1) {
alert("Atention: You have to set cookies on.");
}
</script>

This function works well in Firefox, but dont work im Microsoft
Internet Explorer 6.

Why? I dont undestand why!

Can anyone helpme? Thanks.


There is the standard functionality that works both IE (5.0 and more)
and Firefox
if (window.navigator.cookieEnabled)
{
//....
}

Jun 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mandy Holmes | last post by:
Hi all (Newbie alert!) I am a bit stuck. I want to set a cookie when a hyperlink on my website is clicked. This cookie will then be used to determing which of 5 images is displayed on that page...
4
by: Robin Briggs | last post by:
Hi. I have an ASP (3.0, not .NET) app that writes cookies with hyphens and spaces in the names and values. If I had the control over the apps that will be looking for these cookies, I would...
3
by: Joel Byrd | last post by:
Using javascript to set cookies is apparently not working in Firefox. Here's a simple test page that works in IE, Opera, Netscape, but not Firefox (The javascript is right on the page): ...
10
by: Stephan Schulz | last post by:
Hi all, I'm fairly new to JavaScript, and couldn't find a way to solve the following problem: I've written an application in DHTML/JavaScript, for one because I want to be able to offer...
0
by: dawson | last post by:
I started off by trying to use the HttpCapabilitiesBase.Cookies Property (Note: This property is new in the .NET Framework version 2.0) however it kept on returning true even when I disabled...
1
by: John A. Bailo | last post by:
This is a general web development question about persistant cookies. I thought I would use persistant cookies to indentify unique visitors to my site. When testing my cookie setting code, I...
1
by: stillworkingfortheman | last post by:
I'm loosing cookies in IE6 (works in firefox) when with the following steps... step 1. set a cookie in one domain, in an .aspx.cs codebehind... in www.domain.com/subdomain1/page1.aspx...
0
by: stillworkingfortheman | last post by:
I'm loosing cookies in IE6 (works okay with firefox) with the following steps... step 1. set a cookie in one domain, in an .aspx.cs codebehind... in www.domain.com/subdomain1/page1.aspx...
1
by: demareg | last post by:
When run from local files, my javascript code sets cookies properly and they are visible under the Firefox options. Unfortunately, document.cookie returns an empty string as if cookies are not...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.