Xeo
Xeo

Reputation: 357

Looking for the correct technique for cookie's and redirecting

So here is the situation, the website has code in the head that redirects to the mobile site. However, on the mobile site it has a link to load the actual site. I have never attempted cookies before, so would I use an onclick="dropCookie()" on the link going to the actual site then have the redirect script not redirect if that cookie is found? Any examples of how this works would be amazing! Thank you.

Upvotes: 0

Views: 75

Answers (1)

Rob W
Rob W

Reputation: 349262

A better method to redirect mobile browsers is to check the User agent (UA) string. See this page for a list of mobile UA strings.

If you're using PHP, use this variable to get the UA string: $_SERVER['HTTP_USER_AGENT'].

Upvotes: 1

Related Questions