I've done some searching but cannot find anything that helps.
I'm going to be placing banner ads and would like the customer to go to the correct store based on their device, depending if they are on a reg android or a kindle (also others that use amazon store).
If I were doing this to detect ios or android I would use $_SERVER['HTTP_USER_AGENT'];
Would this method give me a string where I'm able to pull amazon out of it? Or would it just display android like all others?
If this method wouldn't work, can someone point me in the right direction? Thanks.
**I'd like to keep it php
Thank you for the direction, a ton easier than I thought. For future use, this is the code i'm using.
I've tested on the newest kindle fire, a non-android phone and a browser. Those three instances work.
<?php
$amazon = strpos($_SERVER['HTTP_USER_AGENT'],"Silk");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$kindle = strpos($_SERVER['HTTP_USER_AGENT'],"Kindle");
if ($amazon || $kindle == true)
{
header('Location: http://www.url1.com');
}
elseif($android == true){
header('Location: http://www.url2.com');
}
else {
header('Location: http://www.url2.com');
}
?>
For Kindle Fire, you can check the user agent "Silk" as stated in information on Silk
Also check this question .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.