Custom web patch not taking

Discussion about devices being detected incorrectly. You can submit incorrectly detected user agents online at http://www.tera-wurfl.com/ua_submission

Custom web patch not taking

Postby marcguay » Mon May 31, 2010 11:46 am

Hi folks,

I've added the following UAs to the custom_web_patch through the admin panel

Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; xx-xx) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7D11
Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; xx-xx) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10
Mozilla/5.0 (iProd; U; CPU iPhone OS 3_2 like Mac OS X; xx-xx) AppleWebKit/531.21.10 (KHTML, like Gecko)
Mozilla/5.0 (iPad Simulator; U; CPU iPhone OS 3_2 like Mac OS X; HW i386; en_us) AppleWebKit/525.18.1 (KHTML, like Gecko)

then cleared the cache and reloaded the database ("Update database from local file"), but when I use the test script they all fall back to

'id' => 'apple_ipad_ver1',
'fall_back' => 'apple_generic',

Any ideas?
marcguay
 
Posts: 17
Joined: Mon May 31, 2010 11:42 am

Re: Custom web patch not taking

Postby kamermans » Mon May 31, 2010 4:25 pm

Interesting. I am looking into this now. I'm assuming you know that if this works properly these devices will be fall back to the generic_web_browser.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Custom web patch not taking

Postby kamermans » Mon May 31, 2010 4:48 pm

Ok, here's the problem. The admin panel's web patch simply adds new user agents to the WURFL and identifies them as web browsers. Apparently, what you want to do is override the capabilities of the iPad so it's detected as a desktop browser, and not redirected to your mobile site (I'm guessing). To accomplish this, you need to override the iPad device and change it's is_wireless_device property from true to false. In Tera-WURFL and the official WURFL APIs, you need to create a patch file that overrides the root iPad device - the one that all the other iPad devices fall back on. In the WURFL, these root devices are always given the suffix _ver1. In your case, the iPad root device is apple_ipad_ver1.

Here's the WURFL Patch file that will do what you want:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wurfl_patch>
   <devices>
      <device user_agent="Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; xx-xx) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7D11" fall_back="apple_generic" id="apple_ipad_ver1">
         <group id="product_info">
            <capability name="is_wireless_device" value="false"/>
         </group>
      </device>
   </devices>
</wurfl_patch>


To use this, make a new file (let's call it override_patch.xml ), then paste the code from above into this file. Now edit TeraWurflConfig.php and find the $PATCH_FILE directive; by default it is set to
Code: Select all
public static $PATCH_FILE = 'custom_web_patch.xml;web_browsers_patch.xml';

You will need to change it as follows so it loads your new patch file:
Code: Select all
public static $PATCH_FILE = 'custom_web_patch.xml;web_browsers_patch.xml;override_patch.xml';
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Custom web patch not taking

Postby marcguay » Tue Jun 01, 2010 9:48 am

kamermans wrote:Ok, here's the problem. The admin panel's web patch simply adds new user agents to the WURFL and identifies them as web browsers. Apparently, what you want to do is override the capabilities of the iPad so it's detected as a desktop browser, and not redirected to your mobile site (I'm guessing).


So if I understand correctly, the admin panel is strictly for adding UAs that don't already exist? The patch works like a charm, thanks again for all of your help

Marc
marcguay
 
Posts: 17
Joined: Mon May 31, 2010 11:42 am

Re: Custom web patch not taking

Postby kamermans » Tue Jun 01, 2010 1:19 pm

Correct - the admin panel's patch interface is just for adding desktop user agents that are being improperly detected as mobile devices. A common use for this is to aid in the detection of new web browsers before the web browsers patch is updated and released.

Technically speaking, this produces a patch file with new WURFL IDs containing the user agents that you paste in the box. The reason it doesn't work for user agents that already exist is that since the WURFL IDs are dynamically generated, the patch file does not override the existing device, it just adds another device with the same user agent.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Custom web patch not taking

Postby minarater » Fri Apr 15, 2011 9:02 am

It is good to add another device to the same user. This could let me use the feature on some cases. I just need to make my thing working later.
minarater
 
Posts: 1
Joined: Fri Apr 15, 2011 8:56 am

Re: Custom web patch not taking

Postby kamermans » Sat Apr 16, 2011 11:23 pm

What are you talking about minarater? If this is an attempt to implement "SEO" you should at least make sense and preferably add something to the conversation. Please don't mistake my sig links as SEO - I'm the author, maintainer and sponsor of this project :P
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Custom web patch not taking

Postby b0ngma01 » Wed May 25, 2011 3:36 am

Hi kamermans,
I have an idea that will use php to create files that xml.Sau will use it to patch.
Because I want to edit on a database, can you help me know the record is?
I tried editing in table and table twu_Merge twu__Apple iPhone 3, but then I try again it still does not work as expected
b0ngma01
 
Posts: 8
Joined: Mon May 16, 2011 1:29 pm

Re: Custom web patch not taking

Postby kamermans » Wed May 25, 2011 10:27 am

If you need to edit the data in the underlying database you will need to do so in two places, the TeraWurflMerge table (like you saw) and the corresponding user agent matcher table (e.g. TeraWurfl_Qtek). To find the user agent matcher table for a given ID you will need to join the TeraWurflIndex table. If you add a new device, it will need to be added to all three tables and contain a valid fallback device ID or the library will through an exception. Most of the capabilities are not on the actual device, for example the apple_iphone_ver1 does not contain the brand_name = 'Apple', that comes from its parent somewhere down the line, maybe apple_generic. After you make any changes, you will need to truncate your TeraWurflCache table since all lookups are cached there.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX


Return to Device Detection Problems

Who is online

Users browsing this forum: No registered users and 2 guests

cron