Jump to content

different search url for different browsers


Energy313

Recommended Posts

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?


 



 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.