Max
Max

Reputation: 629

mobile to full view from subdomain via button (PHP)

i found a script to link to an subdomain if you are on a mobile site. but how can i manage to have a button on my mobile site to link to the full view-non-subdomain in php?

heres the code:

if(strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
   strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
   header('Location: http://m.ihreseite.ch');
   exit();
}

thanks

Upvotes: 0

Views: 167

Answers (2)

John C
John C

Reputation: 8415

You can set a variable to flag that you want to stay on the full site, then save this in a session or cookie. You can see an example in a previous questions (or this one) along the same lines.

Upvotes: 0

ActuallyMAB
ActuallyMAB

Reputation: 224

This can give you an idea. You can set it basicly to session and get this session variable. Check each page if visitor choose mobile or real website. Then redirect them to website which they want to surf.

Upvotes: 2

Related Questions