Jump to content

different search url for different browsers


Energy313
Go to solution Solved by davidannis,

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?


 



 

Link to comment
Share on other sites

  • Solution

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.