Jump to content

Getting Handset Device Name


Jetheat

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/292081-getting-handset-device-name/
Share on other sites

That js file has been minified.  It's not in a readable format.

 

eval(function(p,a,c,k,e,d){e=function©{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©+'\\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,{}))

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.