I have a setup where some pages are not suitable for the mobile theme, unfortunately.

I have set the theme switching to be based on the URL. I have added redirect options to not-redirect for paths that do not render well in the mobile theme.

The redirect exceptions work well when the mobile user is sent a link to the desktop URL. It will redirect the user to m. for any page not in the exception list. However, I want the inverse to happen when a mobile user clicks through to a URL in the exception list if they started with the mobile theme.

I read though the code in mobile_tools_device_redirect() and have made an adjustment that works well for me. I'm not sure if it is beneficial to others (or if it breaks sites not using my configuration), but I wanted to pass it on.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

douglasmiller’s picture

New patch removes the requirement for the device to me mobile. This covers cases where links contain ?device=desktop from using theme switching based on device type.