How to redirect mobile devices to mobile website?

jackson

Does anyone know a good guide for how to detect and redirect website visitors that are using mobile devices/browsers?

Answer this Question

Answers

3 total
Christopher Nerney
Vote Up (12)

This one, from InMotionHosting.com, covers several options:

 

To redirect a mobile visitor, you'll need to determine if their browser is a web browser on a mobile device or not. You can determine which browser the visitor is using. ...

 

If you are running a Content Management System (such as WordPress or Joomla), there may be plugins already available that help with handling mobile visitors. ...

 

Because mobile phones typically have a small screen width, you can redirect visitors to your mobile site if they have a screen width of less than or equal to 800 pixels. Place Javascript window.location code in the head section of your main website code. That way when your site is visited, the javascript will see the browser width and redirect to the appropriate site. ...

 

You can use a .htaccess redirect to transfer visitors based upon the MIME types the browser supports. For example, if the user's browser accepts mime types that include WML (Wireless Markup Language), then most likely it is a mobile device. The code below should be placed in your .htaccess file.

 


 

 

jimlynch
Vote Up (11)

If you're using WordPress, try the Jetpack plugin. That comes with a free mobile version that you can enable. Anybody on a phone will see the mobile version automatically.

http://wordpress.org/extend/plugins/jetpack/

Ask a question

Join Now or Sign In to ask a question.
GitHub has been called the 'social network for programmers.' Here's how to get started on the popular site for sharing and hosting code (and other things).
Despite becoming one of the most widely used programming languages on the Web, PHP didn't have a formal specification -- until now.
Linux’s creator goes on another epic rant
In response to a query from Vint Cerf, professional developers explain why they don’t feel a membership in the Association for Computing Machinery is worth the cost
The venerable GNU compiler wins the ACM’s Programming Languages Software Award while simultaneously coming under fire from the Linux creator
Devops could be the latest and greatest buzzword, but it could also mean big and important changes - for the better- at many organizations in how applications are built and deployed.
Only six weeks after its release, Apple’s new programming language appears to already be on its way to replacing Objective-C
Beginning this fall, French primary school students will have the option of learning computer science
The recent release of Ubuntu 14.04 Long Term Support/LTS (Trusty Tahr) proves to us once again that it doesn't matter if you're Oracle, Microsoft, or Canonical: Bringing a fleet of products into new release revision synch is tough.
A new GitHub repo is collecting the life lessons that one can learn from programming
Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

randomness