I'm trying to detect a user's mobile handset when he visits my web page.
So on my web page, I have placed this Javascript code:
<html xmlns="XHTML namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type='text/javascript' src="js/wurfl.js">
</script>
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
console.log(WURFL);
document.write(WURFL.form_factor);
</script>
</body>
</html>
Inside the wurfl.js file, it says this:
eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 2={"1":0,"4":"5 8 7","6":"9"};',10,10,'false|is_mobile|WURFL|var|complete_device_name|generic|form_factor|browser|web|Desktop'.split('|'),0,{}))
When I visit the web page from my iPhone it simply outputs: "Desktop" instead of "iPhone". Any idea what could be wrong? Thanks JH PS: I dont know any javascript. Just asking for help on what I could change.