Jetheat Posted October 26, 2014 Share Posted October 26, 2014 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?ThanksJHPS: I dont know any javascript. Just asking for help on what I could change. Quote Link to comment Share on other sites More sharing options...
MDCode Posted October 26, 2014 Share Posted October 26, 2014 That js file has been minified. It's not in a readable format. Quote Link to comment Share on other sites More sharing options...
Jetheat Posted October 27, 2014 Author Share Posted October 27, 2014 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,{})) Quote Link to comment Share on other sites More sharing options...
MDCode Posted October 27, 2014 Share Posted October 27, 2014 The JavaScript itself is minified. No matter how you post it here, it's not readable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.