Reputation: 3296
I am writing a mobile detect script to use across multiple projects and I wanted to gage the community to see if you all can help me figure out the best way todo something.
My mobile detect script works great and directs traffic as expected. The part I wanted to get my fellow programmers opinion on is the "override" feature. Allowing people to view the main site if they wish. My questions for you all, is how should I control the override? Should I use sessions to store the override variable or should I use cookies?
My first thought was sessions, but this script will be included across hundreds of locations and I am concerned about interference in the sessions with some of the projects. For instance, if one of the projects destroys the sessions for logging in and out a user, we will lose the "override" setting also.
What are your thoughts?
Upvotes: 0
Views: 503
Reputation: 5882
Use a cookie:
I should have recommand LocalStorage too, but it's just for the fun, cookies are good enough.
Upvotes: 1
Reputation: 4266
I advice you to use cookies, even if the user is changing of device / clean cookies, programmatically, cookies is the must for your problem
Upvotes: 2
Reputation: 53636
I would just use a cookie, I think session management is overkill for this requirement.
Upvotes: 1