Page 1 of 1

Desk top browser detected as mobile device and patch trouble

PostPosted: Sun Dec 26, 2010 7:54 am
by Willy
Hi,

I have a user that is on IE8 but her browser is detected as a mobile device.

When I submit this useragent to your useragent analysis tool I am told:

"With the current version, Tera-WURFL 2.1.2 (Stable), this user agent is detected as a desktop browser / bot:

Device: generic web browser
Screen Resolution: N/A
WURFL ID: generic_web_browser
Fallback Tree: generic_web_browser -> generic_xhtml -> generic

If this is the correct device, then there is something different with your version of Tera-WURFL. Either your version is out of date and you need to install a new version, or you need to update your WURFL file using your web administration page.

If this is the same result that you are getting, you may continue with your submission below. Please take a moment to verify your information:

User Agent: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; ImageShack Toolbar 4.6.0; FDM; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn Optimi
Version: 2.1.2"


However, I am using the latest version, 2.1.3.

I generate a patch file using her browser's useragent string.

When I try to update the database I get an error stating the useragent is too long.

Here´s the custom_web_patch.xml content:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="&quot;Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; ImageShack Toolbar 4.6.0; FDM; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn OptimizedIE8;ESES)&quot;" fall_back="generic_web_browser" id="terawurfl_generic_web_browser0"/>
   </devices>
</wurfl_patch>


Any suggestions?

Thanks,

Greetings.

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Sun Dec 26, 2010 6:55 pm
by kamermans
Hi, I'm not sure why Tera-WURFL Explorer is detecting it and your installation is not - usually this is due to differences in the wurfl.xml file, so I would make sure you update to the latest one. As far as your patch is concerned, yes the user agent is too long. We limit user agents to 255 characters due to cases like this. In your case, the "&quot;" is not supposed to be on either end and since Tera-WURFL matches by removing characters from the right end until it finds a match, you can safely remove some from that end to get under the limit, like this:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; OfficeLiveConnector.1.3;" fall_back="generic_web_browser" id="terawurfl_generic_web_browser0"/>
   </devices>
</wurfl_patch>


For reference, the user agent as I've trimmed it above is 148 chars.

This should update fine and get you back up and running!

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Sun Dec 26, 2010 7:55 pm
by Willy
Hi,

Thanks for the quick reply.

I am using the latest wurfl.xml. I am using a customized wurfl.xml made with your customizer. I only selected is_wireless_device for my wurfl.xml. Could this have something to do woth the problem?

I applied the patch you gave me above successfully.

Now I'll have to wait and see what my visitor with the problematic useragent reports.

I'll get back with any news.

Greetings.

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Tue Dec 28, 2010 8:06 pm
by kamermans
In order to test this user agent you can go to your Tera-WURFL admin page and click on "Tera-WURFL test script", then paste the user agent in the box and press enter. Using just "is_wireless_device" is fine if that's the only capability you're concerned about - I'm glad to see people are using the WURFL Customizer!

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Tue Dec 28, 2010 8:20 pm
by Willy
Just about ten minutes ago my troubled user informed me that she is still being taken to the mobile version of my forum. :cry:

The Wurfl Customizer is a very good tool, it cuts down on many things. All I need to know is whether it's a mobile device or not. This serves to show a normal or a mobile version of my forum, automatically.

I used the Test script on my TERA Wurfl admin panel to test the useragent as you pasted in you earlier post and this is the result:

Code: Select all
Test resulted in a conlusive match

array (
  'id' => 'generic_web_browser',
  'fall_back' => 'generic_xhtml',
  'user_agent' => 'Mozilla/4.0',
  'product_info' =>
  array (
    'is_wireless_device' => false,
  ),
  'tera_wurfl' =>
  array (
    'num_queries' => 2,
    'actual_root_device' => '',
    'match_type' => 'exact',
    'matcher' => 'SimpleDesktopUserAgentMatcher',
    'match' => true,
    'lookup_time' => 0.0023069381713867,
    'fall_back_tree' => 'generic_web_browser,generic_xhtml,generic',
    'matcher_history' => 'SimpleDesktopUserAgentMatcher(exact)',
  ),
)


Pretty clear, isn´t it. ;)

To me it's a mystery why she is taken to the mobile version by mistake.

Could it be some setting in her browser?

Greetings.

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Tue Dec 28, 2010 8:25 pm
by kamermans
To be sure, you can edit TeraWurflConfig.php and change the LOG_LEVEL to LOG_INFO, then have her repeat her test and put the LOG_LEVEL back to normal, then check the data/wurfl.log file and you will see more detailed info about how/why Tera-WURFL decided she was using a mobile browser. Also, if you are using a 301 redirect like header("Location: blahblah.php");, then her browser may be caching this redirect. You can use other types of redirects to prevent this: http://en.wikipedia.org/wiki/URL_redire ... _codes_3xx

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Tue Dec 28, 2010 8:28 pm
by kamermans
Also, I see that the user agent was matched with SimpleDesktopUserAgentMatcher, which means that you don't need the patch file at all, since this User Agent Matcher is able to determine that the device is a desktop browser without checking WURFL database. It sounds like you've got an issue with your redirect code.

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Wed Dec 29, 2010 4:33 am
by Willy
Thanks again Steve,

I'll use the LOG_INFO to try and gather more info.

There's no redirects that could be messing things up.

Could it be that my detection code is working bad only for a particular useragent/browser?

My code is a simple piece of php code that determines if the mobile template needs to be served or not:
Code: Select all
require_once($_SERVER['DOCUMENT_ROOT'] . '/wurfl/TeraWurfl.php');
$wurflObj = new TeraWurfl();
$matched = $wurflObj->getDeviceCapabilitiesFromAgent();
if($wurflObj->getDeviceCapability("is_wireless_device")){
   $mobile = true;
   $template_name = 'subMovil';
} else { //Added else to check Mali
   $template_name = $row['template_name'] ;
   }


This code seems to be working fine in general, all my tests have given the proper result, it seems to be only this user that has a problem. But there's probably other visitors with the same problem but not notifying me.

Greetings. ;)

Re: Desk top browser detected as mobile device and patch tro

PostPosted: Wed Dec 29, 2010 3:24 pm
by kamermans
Your code looks fine indeed. The Tera-WURFL test page on your server runs the same code as your script, $wurflObj->getDeviceCapabilitiesFromAgent(), so it will get the same results. Since everything else seems pretty concrete, I suspect her browser is doing something kinda funny, and not sending the user agent that you've posted, or there is some other caching issue going on, but at this point the cache should have expired from a couple days ago anyway. Strange!