-4

Possible Duplicate:
PHP mobile browser detection?

How can I use PHP to display different sites based on whether the user is on a mobile or desktop device?

Community
  • 1
  • 1
Harikrishnan N
  • 874
  • 1
  • 10
  • 19

2 Answers2

0

There is a mobile detection plugin for PHP that would allow you to specify how the user views the page. If you didn't want to do pure CSS changes, you could forward them on to a subdomain (m.mysite.com) to a virtual path (mysite.com/mobile) using this plugin.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200
0

It seems that you need basic knowledge on implementation such work. Ok you have to do two things.

  1. First you have to detect whether the request came from a mobile device or from a computer.

  2. For visual aspects you can redirect user to your mobile page or you can display same page as a mobile friendly page using relevant HTML and CSS rules.

To detect whether the request came from a mobile device. You can use some plugin or a class already developed. It will make your work easier.

I have used following class for one of my project and it works well.

http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/

Cheers!

Prasad Rajapaksha
  • 6,118
  • 10
  • 36
  • 52