now a days you can put wallpapers anywhere, its not just for desktops anymore
its for laptops, pda's, cellphones, smart phones etc..
so there will come a time when you will have to provide content for wurl users
so just how can you detect if a user is using a cell phone when they visit your site.
there are a number of way, the easiest i know how is to do it server side
with php you can do that
php is very powerful programming language that lets you do alot of things for your website
so often i used this function or class to detect if a user visiting my site is coming from a mobile device or not
<?php
function checkmobile(){
if(isset($_SERVER["HTTP_X_WAP_PROFILE"])) return true;
if(preg_match("/wap.|.wap/i",$_SERVER["HTTP_ACCEPT"])) return true;
if(isset($_SERVER["HTTP_USER_AGENT"])){
$uamatches = array("midp", "j2me", "avant", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows ce", "mmp/", "blackberry", "mib/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up.b", "audio", "SIE-", "SEC-", "samsung", "HTC", "mot-", "mitsu", "sagem", "sony", "alcatel", "lg", "eric", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "dddi", "moto");
foreach($uamatches as $uastring){
if(preg_match("/".$uastring."/i",$_SERVER["HTTP_USER_AGENT"])) return true;
}
}
return false;
}
if(checkmobile()){
echo '
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<title>Google</title>
</head>
<body>
Hello Mobile User, Welcome to Wallpaperama.com
</body>
</html>
';
}else{
echo 'NOT you are using a mobile phone';
}
?>
check it out, if you have a mobile phone or device and you are have access to internet, go to
http://www.wallpaperama.com and you will be automatically directed to our mobile website
Try it!!