FINAL UPDATE: Detecting and automatically redirecting website visitors who visit a standard webpage / website on mobile, handheld, wireless, PDA, or cel / cell phone devices / browsers to a mobile version of the webpage or website

DEPRECIATED – For an up-to-date version of the Studio Hyperset PHP mobile redirect script, please visit SH‘s Google code project site. To read more about the script, please visit this hyper/boʊl/e post and the mobile redirect code discussion index.

This is the final posting of a conversation begun October 8th and continued on November 12th re: detecting and automatically redirecting website visitors who visit a standard webpage / website on mobile, handheld, wireless, PDA, or cel / cell phone devices / browsers to a mobile version of the webpage or website.

Thanks to a helpful hint from “Megan” on the 11/12 posting, I was able to stop the PHP script from looping and found a useful way to have it executed when the index.php homepage loads.

I also combined the HTTP_USER_AGENT strings in the moble.asp and mobile.php files to create one PHP file (mobile.php). This make the mobile.asp file largely unnecessary, but I’ve included it in the final .zip file below (redirect3.zip) for the sake of those who prefer ASP to PHP and would like to experiment with/use that language. The mobile2.asp file is also included on the Studio Hyperset site, but I suspect it’s largely non-functioning. The unified PHP file (mobile.php) works fine, though, and seems to be automatically driving visitors using a mobile device to the Studio Hyperset mobile page. This is true for whatever device Megan tested the script on and SH co-founder Isaac Melton’s LG Chocolate phone.

In the interest of bearing witness to full development of this project, I stripped out three HTTP_USER_AGENT strings that appeared in the mobile.asp file in the outside chance that they would inadvertently redirect visitors using standard laptops/desktops to the SH mobile site: “Dell,” “Compaq,” and “Toshiba.”

Finally, here’s how I’ve included the mobile.php and mobile2.asp files in the code of the Studio Hyperset homepage:

At between the <head> tags, I’ve placed the following lines of code. Note the absolute file source links:

<?php include ('http://www.studiohyperset.com/scripts/mobile.php'); ?>

<!--#include file="http://www.studiohyperset.com/scripts/mobile2.asp" -->

Here’s the final .zip file containing all the mobile redirection scripts: redirect3.zip. (A single PHP file is now hosted at Google Code.)

Exit mobile version