Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-09-25
5
Medium Priority
?
58 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

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 84

Expert Comment

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

721 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