How to Enable Smartphone Capability for Websites

  • Share
  • Print this article
How to Enable Smartphone Capability for Websites thumbnail
Automatically activate the mobile version of your website for smartphone users.

Smartphone Internet browsers nearly rival home computers for casual Web browsing. As a result, content creators and Web designers need to accommodate their blogs and websites. Once you have established the mobile-friendly version of your website, you can add a PHP script that automatically redirects and activates the mobile version for visitors on mobile browsers such as the iPhone, BlackBerry or Android operating system.

Instructions

    • 1

      Open the HTML editor for the homepage of your website. If you have a blog, you can open the primary editor for your header.

    • 2

      Paste the following code into your HTML:
      <? if (
      stristr($ua, "AvantGo") or
      stristr($ua, "T68") ) {
      $DEVICE_TYPE="MOBILE";
      }
      if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") {
      $location='mobile';
      header ('Location: '.$location);
      exit;
      }
      ?>

    • 3

      Edit the "$location=" field to the specific location of your mobile site. For example, the mobile version of your site might be something like "http://www.mysite.com/mobile1/index.php." In that case, your code would be "$location=mobile1/index.php" in the script.

Tips & Warnings

  • You can add new browser user-agent IDs (in the "stristr" section of the script) by checking the latest updates at an open-source archive such as WURFL.

Related Searches

References

  • Photo Credit Photos.com/PhotoObjects.net/Getty Images

Comments

Related Ads

Featured
View Mobile Site