473,749 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why won't cookies work with my javascript under Safari?

I have been testing some javascript for my professional society web
page, and found that I couldn't get Safari to save any cookies. No
matter what I assign to document.cookie , I get an empty string when I
read back document.cookie .

In researching this problem, I found a function on the Apple website
to test for cookies. I found that the function sometimes tells me
cookies are enabled and sometimes disabled, as follows:

1) Open the Safari Developers FAQ
(http://developer.apple.com/internet/...afari_faq.html)

2) Push the "Got Cookies?" button. I get the reply "You got cookies",
meaning that cookies are enabled.

3) Save the webpage to my hard disk.

4) Open the file that I just saved on the hard disk.

5) Push the "Got cookies?" button. I now get the reply "No cookies",
meaning that cookies are disabled.

Is there anything weird one must do to a website to get cookies to
work under Safari?

- David Gauntt
Jul 23 '05 #1
1 2798
David M. Gauntt wrote:
1) Open the Safari Developers FAQ
(http://developer.apple.com/internet/...afari_faq.html)

2) Push the "Got Cookies?" button. I get the reply "You got cookies",
meaning that cookies are enabled.

3) Save the webpage to my hard disk.

4) Open the file that I just saved on the hard disk.

5) Push the "Got cookies?" button. I now get the reply "No cookies",
meaning that cookies are disabled.

Is there anything weird one must do to a website to get cookies to
work under Safari?


No. Cookies tend not to work with "file:" URIs in Web browsers,
particularly "file:" URIs do not support a domain part that would
be used to identify the domain of which resources are allowed to
read the cookie.
PointedEars
Jul 23 '05 #2

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

Similar topics

2
5583
by: Michael | last post by:
I am reading and setting a cookie using JavaScript in the BODY onload and onunload events respectively. This works fine. However when I use ASP to set the cookie under some condition where I want to override the last value set in the onunload event, it has no effect. The next onload still has the old value. Any ideas? The following code simulates the problem I experience. --------------------------------------------------
1
2979
by: Sam Wuebben | last post by:
I am using a standard javascript that I downloaded from javascriptsource.com to read from and fill in a form using cookies. The page tests well in every browser except Apple's Safari (from 10.3.2) Unfortunately, my clients daughter uses Safari so I have to get it to work with it, even though most of his clients use IE. What do I need to do to change the code so this will all work in Safari?
1
1601
by: FayeC | last post by:
I got this snippet online and for the life of me I can't seem to make it write the cookie.... The Flash has the labels mentioned in the code and I used the name=movie and the swconnect=true as mentioned in the comments. The movie is fine.....the code is just not writing the cookie at all... Could someone take a look and see if you can figure out why it won't work? Thanks, FayeC
4
1975
by: 2obvious | last post by:
I'm trying to set a cookie to expire 10 seconds after it is created. However, it seems to last until I close all browser windows. var objDate = new Date(); objDate.setSeconds( objDate.getSeconds() + 10 ); document.cookie = "hasSeenPopup=TRUE;"; document.cookie += "expires=" + objDate.toGMTString(); I then set the cookie to expire in 1000 seconds, to test that it could indeed last longer than a session. However, when I close all...
3
2638
by: Raghu Raman | last post by:
Hi, I want to store a cookie peemanently for 2 days.From msdn article, i have coded like this.It is working when i run my application .But if i close my browser and restart my application , i could not find the stored cookie,it was gone . my code -----------------
10
1885
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 access on the web, but primarily because it was the easiest way for me to combine GUI and layout in a portable manner.
13
11501
by: TLaufenberg | last post by:
I'm new to Javascript programming and I've run into a bit of a snag with making an XMLHttpRequest in the Safari browser. Actually, the request doesn't work in Firefox either but only when I use a Mac computer. IE and FireFox on a Windows based system works just fine. The problem I am having is that the XMLHttpRequest doesn't open the site that I've programmed into it. When I check the readyState it only returns 0 and never goes through the...
24
2471
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I see in javascript if a web browser accepts cookies? ----------------------------------------------------------------------- Writing a cookie, reading it back and checking if it's the same. http://www.w3schools.com/js/js_cookies.asp Additional Notes:
0
8997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6801
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.