Energy313 Posted August 15, 2013 Share Posted August 15, 2013 I’m using the following code for search: if(isset($_POST['btnFinnBaat'])) { $url = 'http://www.finn.no/finn/boat/used/result?sort=0&keyword='. urlfix2($_POST['finn']); }The problem is that the website I refers to has a mobile phone website and redirects directly to this website with a different url for mobile phones.What I need is an if code to give a second option for mobile phones with the option 2 to give right url for mobiles and tablets, without having to make a whole New website just for mobile phones. To see the problem:Website: dinstartside.no >> do a search with finn (blue logo) and search for "Toyota" >> use "Bil" button (Cars) With all the PC browsers it works fine, but not with a mobile or tablet. Anyone? Link to comment https://forums.phpfreaks.com/topic/281216-different-search-url-for-different-browsers/ Share on other sites More sharing options...
davidannis Posted August 17, 2013 Share Posted August 17, 2013 I believe that you want to look at $_SERVER['HTTP_USER_AGENT'] and decide if it is a mobile browser and then return a different url if it is: http://php.net/manual/en/reserved.variables.server.php I believe that if you are willing to depart from just using php you can use jQuery to deliver a version of the site optimized for mobile but that is beyond my pay grade and belongs in the javascript section of the forums. Link to comment https://forums.phpfreaks.com/topic/281216-different-search-url-for-different-browsers/#findComment-1445458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.