Disable Wurfl redirect for mobile browsers

January 31, 2011
by Adrian

DotKernel has an example mobile site at http://v1.dotkernel.net/mobile that uses jQuery Mobile.

Wurfl is also used to detect mobile browsers (as discussed in a previous blog post) and automatically redirect them to the mobile site the first time they view the homepage. Sometimes, this behavior isn’t desired (for example when you don’t have a mobile site, or you don’t plan on using Wurfl at all)

Starting with revision 408, there’s an option in application.ini to disable the automatic redirect (by default the redirect is disabled):

resources.useragent.wurflapi.redirect = false

The following condition is also added to Controllers/frontend/IndexController.php (at line 19) to check the configuration:

//if automatic redirect is enabled in application.ini and the browser is mobile and session->mobileHit is not set, register it and redirect
if($config->resources->useragent->wurflapi->redirect && 'mobile' == Dot_Kernel::getDevice()->getType() && !isset($session->mobileHit))

This entry was posted in DotKernel. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>