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? Quote Link to comment Share on other sites More sharing options...
Solution davidannis Posted August 17, 2013 Solution 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.