mobile users
Mobile device users

If you’ve created a mobile version of your website, you’ll need to be sure that you redirect your mobile visitors to your mobile website. For example, if someone visits domain.com on their phone, you’ll need a way to redirect them to m.domain.com (the mobile version of your site created on a subdomain called “m“).

The question then becomes, “How do you automatically send users to the mobile site?”

If you think about how your redirect actually works, in theory, it’s easy to understand- “If the user is using a mobile device, redirect them to the mobile version of the site“. The solution then relies on how to identify your visitor as a mobile user. There are a few different ways to identify a mobile user:

  • Let the user decide
  • Use JavaScript
  • Use PHP, JSP, ASP to Detect a Mobile Browser
  • Use WURFL (Wireless Universal Resource File)

Searching for a new home for your WordPress site? Try InMotion’s WordPress Hosting solutions for secure, optimized servers that are configured for your budget needs.

If you have a mobile-optimized version of your website, then the easiest thing to do to get users to use that is to provide a link that explicitly says that you have a mobile-friendly website. This allows them to manually select to go to the mobile site. It’s not automatic, but it provides a simple solution to the problem. You don’t need extra code, just a well-described link that will catch a user’s eye on your home page.

Use Javascript or jQuery

Javascript can be used to detect mobile devices and there are a lot of different coded solutions that you can find on the internet. It is a well-discussed topic, just make sure that whatever source you view is up-to-date with the current methods that are recommended. The main issue with using code that is looking for specific mobile devices is that it would need to be constantly updated with newer devices.

Use Programming Code to Detect a Mobile Browser

One very convenient source of code for the purpose of detecting mobile browsers is the Detect Mobile Browsers website. It is an open-source provider of scripts for many different languages. The provided code will be able to detect many different user-agents, but it may not catch all of them, so you would have to be familiar with the code and look for updates, or even update it yourself as per your needs.

Use Wireless Universal Resource File (WURFL)

WURFL actually consists of an API and an XML configuration file that give you access to databases that contain information on a wide variety of mobile devices. The advantage of using WURFL is that while the code of the API may go out-of-date, the information about the mobile devices is regularly updated. You can update it periodically and get the most recent list of mobile devices that are being used. You would need to implement the API on your website in order to use it.

As you can see, there are many different possible solutions to have a separate mobile website that is optimized for your users. However, the best solution recommended by the industry is to use responsive design. This allows you to have only ONE set of code for your website. Using responsive design is the ideal solution as it saves time and makes management of your website easier. There’s no need to worry about updating two sites and making sure that both sites are always working.

To learn more about using responsive design, please see our article titled, Introduction: Creating a Responsive Web Design.

Similar Posts