Solved

Cookie set on google chrome doesn't work when using Safari

Posted on 2016-09-25
5
54 Views
Last Modified: 2016-09-25
I am using Chrome to test my registration code. When I register, it sets a cookie valid for 24 hrs so that the person who registered the account has 24 hours to activate their account. If I use google tools I can see that the cookie is definitely set.

When I receive the activation email and click on the link, it takes me to my safari browser as this is my default browser. I then get the message that I set up to say that the activation was unsuccessful because the time expired which is impossible since I did it 30 seconds later. I noticed however that if I copy that link and put it into chrome, it works.

What am I doing wrong? Surely in the real world it doesn't work like this i.e.: if I register on chrome, I can't activate in another browser?
0
Comment
Question by:Black Sulfur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41814404
if I register on chrome, I can't activate in another browser?
Using cookies, No, you can't.  Cookies are set in the browser that was used.  They are Not available to any other browser.  Cookies are never shared between browsers.
0
 
LVL 1

Author Comment

by:Black Sulfur
ID: 41814405
I see. So, I basically can't achieve what I want unless I store the time of registration in the database and compare that with the time the user tries to activate their account?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41814411
What is 'normally' done is to include a long hash as a query string to the link in the email.  Such as https://www.mydomain.com/?q=Asjjkqoorllk1928747665mmnnsjhjkckjdjk where the hash is your code to identify the user.
0
 
LVL 1

Author Comment

by:Black Sulfur
ID: 41814414
Yeah, I have that hash but I also want to have a time limit for them to register which is why I wanted the cookie. But as I said, I think I will just store the time of registration in the database and take it from there.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41814421
Sounds like a plan to me.!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question