I have D6 [version 6.16] running over PHP 5.3 [XAMPP 1.7.3] with the Mobile Tools module installed to detect mobile devices. Other modules I've installed are AdminMenu, ShadowBox and WYSIWYG.

The issue I'm dealing is that my mobile/desktop site keeps displaying the mobile theme in Internet Explorer, with the Theme Switching option set to "Switch theme for a mobile device". However, Firefox, Chrome and Safari shows my desktop theme correctly, as my mobile theme [nokia mobile] in mobile devices.

Can anyone help me here?

PS: All browsers are well updated and don't have any plugin installed. I've tried already disabling all the extra modules but with no positive result.

Comments

xpound’s picture

Title: IE8 displays the mobile theme besides the desktop theme » IE8 displays the mobile theme in spite of the desktop theme
Alexolog’s picture

I have the same problem.

xpound’s picture

Assigned: xpound » Unassigned
xpound’s picture

Component: User interface » Code
Assigned: Unassigned » xpound
Category: bug » support
Status: Active » Needs work
twom’s picture

Hi,

If you are experiencing the problem, can you go to a site like http://whatsmyuseragent.com/ and copy paste your user agent string here?
Example: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.4; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.30729; MS-RTC LM 8; .NET CLR 3.0.30729; .NET CLR 1.1.4322)

xpound’s picture

Hi,

My current header sent by my browser [IE8] is:

HTTP_CONNECTION:keep-alive
HTTP_ACCEPT:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP_ACCEPT_ENCODING:gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE:pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4
HTTP_HOST:whatsmyuseragent.com
HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1045 Safari/532.5

Recently, I tried to access my local site from another computer on the web. In this case, I was using Windows XP Pro and I could see the website perfectly in IE8. Could it be anything around IE8/Win7?

Please let me know if you can find what's wrong.

twom’s picture

I don't see the problem yet, but I can say that this a strange user agent header for a IE8 browser :)
It looks like it want's to hide it's identity...

twom’s picture

I have tested this user agent with mobile tools, and everything seems to work fine...

A question, what happens if you go to http://wwW.osmobi.com or http://www.mobiledrupal.com? Are you being redirected?

xpound’s picture

Freaking Microsoft products! I can't believe... I'm being redirected to the mobile version of the websites [Osmobi and MobileDrupal] with IE8!
The problem is my browser...
And I have my O.S. the cleanest possible! May IE8 have any setting messing with the user agent output?
Should I reinstall my system?

Thanks in advance.

xpound’s picture

twom, I can't say what made my IE8 UA turn like before.
However I've found a little tool capable of changing the User Agent on IE8 almost like the User Agent Switcher for Firefox, but in a permanent way. You can find it at http://www.enhanceie.com/ietoys/uapick.asp.
Maybe I'll delay reinstalling my system! ;)

twom’s picture

Hi,

I'll discuss your problem with the people at http://www.osmobi.com. The same device detection mechanism is being used for Mobile Tools as at OSMOBI.com.

Hope to be able to fix this soon.

Tom

xpound’s picture

Glad to know.

I'm not a web developer yet so I didn't spend time watching Mobile Tools Code. However, I think that the theme switcher should always display the desktop theme as default behaviour and the mobile theme should only be displayed with a mobile device detection event. Maybe there's something happening on the UA/Device detection internal rules.

X.

thwohojr’s picture

I found this website that says the problem is in the scripting of the site... not your browser.
http://broadcast.oreilly.com/2009/12/ie8-64-bit-windows-7-and-the-m.html

eeriepanda’s picture

Actually the problem is IE8 allows any program to modify the user agent. A recent issue I encountered was Creative Sound Suite adding Update to the User Agent. Obviously this is an issue and our fix was to remove PDA from detection.

---

An even better solution would be to determine why/what is using PDA as a user agent and use a more specific regex.

vincentdemers’s picture

In my case the user agent in fault was

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.2; Creative AutoUpdate v1.40.02).

It seems to happen with IE8 running under windows 7 64 bits...

I haxe fixed this by wrapping the switch(TRUE) in _mobile_tools_is_mobile_device() with if (!stristr($user_agent,'mozilla')) {

like this

function _mobile_tools_is_mobile_device() {
  $mobile_browser   = array('type' => 'desktop', 'group' => ''); // set mobile browser as FALSE till we can prove otherwise
  if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
	    $user_agent = $_SERVER['HTTP_USER_AGENT']; 
	  } else {
	    return FALSE;
	  }
	  // get the content accept value
	  // FIXME: this should be cleaned to ensure no nefarious input gets executed
	  if (array_key_exists('HTTP_ACCEPT', $_SERVER)) {
	  	$accept = $_SERVER['HTTP_ACCEPT'];
	  } else {
	  	$accept = '';
	  }
  if (!stristr($user_agent,'mozilla')) {
    switch (TRUE) { 
      case (FALSE !== stripos($user_agent, 'ipod')); // we find the words iphone or ipod in the user agent
        $mobile_browser = array('type' => 'mobile', 'group' => 'ipod'); // mobile browser is either TRUE or FALSE depending on the setting of iphone when calling the function
      break; // break out and skip the rest if we've had a match on the iphone or ipod
      case (FALSE !== stripos($user_agent, 'iphone')); // we find the words iphone or ipod in the user agent
        $mobile_browser = array('type' => 'mobile', 'group' => 'iphone');
      break;
      case (FALSE !== stripos($user_agent, 'android'));  // we find android in the user agent
        $mobile_browser = array('type' => 'mobile', 'group' => 'android');; // mobile browser is either TRUE or FALSE depending on the setting of android when calling the function
      break; // break out and skip the rest if we've had a match on android
      case (FALSE !== stripos($user_agent, 'opera mini')); // we find opera mini in the user agent
        $mobile_browser = array('type' => 'mobile', 'group' => 'opera_mini'); // mobile browser is either TRUE or FALSE depending on the setting of opera when calling the function
      break; // break out and skip the rest if we've had a match on opera
      case (FALSE !== stripos($user_agent, 'blackberry')); // we find blackberry in the user agent
        $mobile_browser = array('type' => 'mobile', 'group' => 'blackberry'); // mobile browser is either TRUE or FALSE depending on the setting of blackberry when calling the function
      break; // break out and skip the rest if we've had a match on blackberry
      case (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|psp|treo)/i',$user_agent)); // check if any of the values listed create a match on the user agent - these are some of the most common terms used in agents to identify them as being mobile devices - the i at the end makes it case insensitive
        $mobile_browser = array('type' => 'mobile', 'group' => ''); // set mobile browser to TRUE
      break; // break out and skip the rest if we've preg_match on the user agent returned TRUE 
      case ((strpos($accept,'text/vnd.wap.wml')>0)||(strpos($accept,'application/vnd.wap.xhtml+xml')>0)); // is the device showing signs of support for text/vnd.wap.wml or application/vnd.wap.xhtml+xml
        $mobile_browser = array('type' => 'mobile', 'group' => ''); // set mobile browser to TRUE
      break; // break out and skip the rest if we've had a match on the content accept headers
      case (isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])); // is the device giving us a HTTP_X_WAP_PROFILE or HTTP_PROFILE header - only mobile devices would do this
        $mobile_browser = array('type' => 'mobile', 'group' => ''); // set mobile browser to TRUE
      break; // break out and skip the final step if we've had a return TRUE on the mobile specfic headers
      case (in_array(strtolower(substr($user_agent,0,4)),array('1207'=>'1207','3gso'=>'3gso','4thp'=>'4thp','501i'=>'501i','502i'=>'502i','503i'=>'503i','504i'=>'504i','505i'=>'505i','506i'=>'506i','6310'=>'6310','6590'=>'6590','770s'=>'770s','802s'=>'802s','a wa'=>'a wa','acer'=>'acer','acs-'=>'acs-','airn'=>'airn','alav'=>'alav','asus'=>'asus','attw'=>'attw','au-m'=>'au-m','aur '=>'aur ','aus '=>'aus ','abac'=>'abac','acoo'=>'acoo','aiko'=>'aiko','alco'=>'alco','alca'=>'alca','amoi'=>'amoi','anex'=>'anex','anny'=>'anny','anyw'=>'anyw','aptu'=>'aptu','arch'=>'arch','argo'=>'argo','bell'=>'bell','bird'=>'bird','bw-n'=>'bw-n','bw-u'=>'bw-u','beck'=>'beck','benq'=>'benq','bilb'=>'bilb','blac'=>'blac','c55/'=>'c55/','cdm-'=>'cdm-','chtm'=>'chtm','capi'=>'capi','comp'=>'comp','cond'=>'cond','craw'=>'craw','dall'=>'dall','dbte'=>'dbte','dc-s'=>'dc-s','dica'=>'dica','ds-d'=>'ds-d','ds12'=>'ds12','dait'=>'dait','devi'=>'devi','dmob'=>'dmob','doco'=>'doco','dopo'=>'dopo','el49'=>'el49','erk0'=>'erk0','esl8'=>'esl8','ez40'=>'ez40','ez60'=>'ez60','ez70'=>'ez70','ezos'=>'ezos','ezze'=>'ezze','elai'=>'elai','emul'=>'emul','eric'=>'eric','ezwa'=>'ezwa','fake'=>'fake','fly-'=>'fly-','fly_'=>'fly_','g-mo'=>'g-mo','g1 u'=>'g1 u','g560'=>'g560','gf-5'=>'gf-5','grun'=>'grun','gene'=>'gene','go.w'=>'go.w','good'=>'good','grad'=>'grad','hcit'=>'hcit','hd-m'=>'hd-m','hd-p'=>'hd-p','hd-t'=>'hd-t','hei-'=>'hei-','hp i'=>'hp i','hpip'=>'hpip','hs-c'=>'hs-c','htc '=>'htc ','htc-'=>'htc-','htca'=>'htca','htcg'=>'htcg','htcp'=>'htcp','htcs'=>'htcs','htct'=>'htct','htc_'=>'htc_','haie'=>'haie','hita'=>'hita','huaw'=>'huaw','hutc'=>'hutc','i-20'=>'i-20','i-go'=>'i-go','i-ma'=>'i-ma','i230'=>'i230','iac'=>'iac','iac-'=>'iac-','iac/'=>'iac/','ig01'=>'ig01','im1k'=>'im1k','inno'=>'inno','iris'=>'iris','jata'=>'jata','java'=>'java','kddi'=>'kddi','kgt'=>'kgt','kgt/'=>'kgt/','kpt '=>'kpt ','kwc-'=>'kwc-','klon'=>'klon','lexi'=>'lexi','lg g'=>'lg g','lg-a'=>'lg-a','lg-b'=>'lg-b','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-f'=>'lg-f','lg-g'=>'lg-g','lg-k'=>'lg-k','lg-l'=>'lg-l','lg-m'=>'lg-m','lg-o'=>'lg-o','lg-p'=>'lg-p','lg-s'=>'lg-s','lg-t'=>'lg-t','lg-u'=>'lg-u','lg-w'=>'lg-w','lg/k'=>'lg/k','lg/l'=>'lg/l','lg/u'=>'lg/u','lg50'=>'lg50','lg54'=>'lg54','lge-'=>'lge-','lge/'=>'lge/','lynx'=>'lynx','leno'=>'leno','m1-w'=>'m1-w','m3ga'=>'m3ga','m50/'=>'m50/','maui'=>'maui','mc01'=>'mc01','mc21'=>'mc21','mcca'=>'mcca','medi'=>'medi','meri'=>'meri','mio8'=>'mio8','mioa'=>'mioa','mo01'=>'mo01','mo02'=>'mo02','mode'=>'mode','modo'=>'modo','mot '=>'mot ','mot-'=>'mot-','mt50'=>'mt50','mtp1'=>'mtp1','mtv '=>'mtv ','mate'=>'mate','maxo'=>'maxo','merc'=>'merc','mits'=>'mits','mobi'=>'mobi','motv'=>'motv','mozz'=>'mozz','n100'=>'n100','n101'=>'n101','n102'=>'n102','n202'=>'n202','n203'=>'n203','n300'=>'n300','n302'=>'n302','n500'=>'n500','n502'=>'n502','n505'=>'n505','n700'=>'n700','n701'=>'n701','n710'=>'n710','nec-'=>'nec-','nem-'=>'nem-','newg'=>'newg','neon'=>'neon','netf'=>'netf','noki'=>'noki','nzph'=>'nzph','o2 x'=>'o2 x','o2-x'=>'o2-x','opwv'=>'opwv','owg1'=>'owg1','opti'=>'opti','oran'=>'oran','p800'=>'p800','pand'=>'pand','pg-1'=>'pg-1','pg-2'=>'pg-2','pg-3'=>'pg-3','pg-6'=>'pg-6','pg-8'=>'pg-8','pg-c'=>'pg-c','pg13'=>'pg13','phil'=>'phil','pn-2'=>'pn-2','ppc;'=>'ppc;','pt-g'=>'pt-g','palm'=>'palm','pana'=>'pana','pire'=>'pire','pock'=>'pock','pose'=>'pose','psio'=>'psio','qa-a'=>'qa-a','qc-2'=>'qc-2','qc-3'=>'qc-3','qc-5'=>'qc-5','qc-7'=>'qc-7','qc07'=>'qc07','qc12'=>'qc12','qc21'=>'qc21','qc32'=>'qc32','qc60'=>'qc60','qci-'=>'qci-','qwap'=>'qwap','qtek'=>'qtek','r380'=>'r380','r600'=>'r600','raks'=>'raks','rim9'=>'rim9','rove'=>'rove','s55/'=>'s55/','sage'=>'sage','sams'=>'sams','sc01'=>'sc01','sch-'=>'sch-','scp-'=>'scp-','sdk/'=>'sdk/','se47'=>'se47','sec-'=>'sec-','sec0'=>'sec0','sec1'=>'sec1','semc'=>'semc','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','sk-0'=>'sk-0','sl45'=>'sl45','slid'=>'slid','smb3'=>'smb3','smt5'=>'smt5','sp01'=>'sp01','sph-'=>'sph-','spv '=>'spv ','spv-'=>'spv-','sy01'=>'sy01','samm'=>'samm','sany'=>'sany','sava'=>'sava','scoo'=>'scoo','send'=>'send','siem'=>'siem','smar'=>'smar','smit'=>'smit','soft'=>'soft','sony'=>'sony','t-mo'=>'t-mo','t218'=>'t218','t250'=>'t250','t600'=>'t600','t610'=>'t610','t618'=>'t618','tcl-'=>'tcl-','tdg-'=>'tdg-','telm'=>'telm','tim-'=>'tim-','ts70'=>'ts70','tsm-'=>'tsm-','tsm3'=>'tsm3','tsm5'=>'tsm5','tx-9'=>'tx-9','tagt'=>'tagt','talk'=>'talk','teli'=>'teli','topl'=>'topl','tosh'=>'tosh','up.b'=>'up.b','upg1'=>'upg1','utst'=>'utst','v400'=>'v400','v750'=>'v750','veri'=>'veri','vk-v'=>'vk-v','vk40'=>'vk40','vk50'=>'vk50','vk52'=>'vk52','vk53'=>'vk53','vm40'=>'vm40','vx98'=>'vx98','virg'=>'virg','vite'=>'vite','voda'=>'voda','vulc'=>'vulc','wapj'=>'wapj','wapp'=>'wapp','wapu'=>'wapu','wapm'=>'wapm','wig '=>'wig ','wapi'=>'wapi','wapr'=>'wapr','wapv'=>'wapv','wapy'=>'wapy','wapa'=>'wapa','waps'=>'waps','wapt'=>'wapt','winc'=>'winc','winw'=>'winw','wonu'=>'wonu','x700'=>'x700','xda2'=>'xda2','xdag'=>'xdag','yas-'=>'yas-','your'=>'your','zte-'=>'zte-','zeto'=>'zeto','acs-'=>'acs-','alav'=>'alav','alca'=>'alca','amoi'=>'amoi','aste'=>'aste','audi'=>'audi','avan'=>'avan','benq'=>'benq','bird'=>'bird','blac'=>'blac','blaz'=>'blaz','brew'=>'brew','brvw'=>'brvw','bumb'=>'bumb','ccwa'=>'ccwa','cell'=>'cell','cldc'=>'cldc','cmd-'=>'cmd-','dang'=>'dang','doco'=>'doco','eml2'=>'eml2','eric'=>'eric','fetc'=>'fetc','hipt'=>'hipt','http'=>'http','ibro'=>'ibro','idea'=>'idea','ikom'=>'ikom','inno'=>'inno','ipaq'=>'ipaq','jbro'=>'jbro','jemu'=>'jemu','java'=>'java','jigs'=>'jigs','kddi'=>'kddi','keji'=>'keji','kyoc'=>'kyoc','kyok'=>'kyok','leno'=>'leno','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-g'=>'lg-g','lge-'=>'lge-','libw'=>'libw','m-cr'=>'m-cr','maui'=>'maui','maxo'=>'maxo','midp'=>'midp','mits'=>'mits','mmef'=>'mmef','mobi'=>'mobi','mot-'=>'mot-','moto'=>'moto','mwbp'=>'mwbp','mywa'=>'mywa','nec-'=>'nec-','newt'=>'newt','nok6'=>'nok6','noki'=>'noki','o2im'=>'o2im','opwv'=>'opwv','palm'=>'palm','pana'=>'pana','pant'=>'pant','pdxg'=>'pdxg','phil'=>'phil','play'=>'play','pluc'=>'pluc','port'=>'port','prox'=>'prox','qtek'=>'qtek','qwap'=>'qwap','rozo'=>'rozo','sage'=>'sage','sama'=>'sama','sams'=>'sams','sany'=>'sany','sch-'=>'sch-','sec-'=>'sec-','send'=>'send','seri'=>'seri','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','siem'=>'siem','smal'=>'smal','smar'=>'smar','sony'=>'sony','sph-'=>'sph-','symb'=>'symb','t-mo'=>'t-mo','teli'=>'teli','tim-'=>'tim-','tosh'=>'tosh','treo'=>'treo','tsm-'=>'tsm-','upg1'=>'upg1','upsi'=>'upsi','vk-v'=>'vk-v','voda'=>'voda','vx52'=>'vx52','vx53'=>'vx53','vx60'=>'vx60','vx61'=>'vx61','vx70'=>'vx70','vx80'=>'vx80','vx81'=>'vx81','vx83'=>'vx83','vx85'=>'vx85','wap-'=>'wap-','wapa'=>'wapa','wapi'=>'wapi','wapp'=>'wapp','wapr'=>'wapr','webc'=>'webc','whit'=>'whit','winw'=>'winw','wmlb'=>'wmlb','xda-'=>'xda-',))); // check against a list of trimmed user agents to see if we find a match
         if (!ereg("w3c_css_validator", strtolower($user_agent))) {        
            $mobile_browser = array('type' => 'mobile', 'group' => ''); // set mobile browser to TRUE
         }
      break; // break even though it's the last statement in the switch so there's nothing to break away from but it seems better to include it than exclude it
    } // ends the switch 
  }
   $result = $mobile_browser;
   return $result;
}
random9q’s picture

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Media Center PC 5.0; SLCC1; Tablet PC 2.0; .NET4.0C; Creative AutoUpdate v1.40.01)

Glad someone commented that Creative Labs's addition of their update to the mobile string caused it to go bonkers.

I also notice looking at my user agent string that the addition of a Wacom pen tablet mutated it into a Tablet PC. Nice. This is my standard Win7-32bit laptop.

Any movement on addressing this semi-permanently, or should I attempt to hack the code roughly as described in the ad hoc patch above?

Thanks, and happy New Year's Day to all...

agrmarcasepatentes’s picture

AGR Assessoria em Registro de Marcas e Patentes. Pesquisa e registro de marca e patente, direito autoral, propriedade industrial e intelectual.

agrmarcasepatentes’s picture

AGR Assessoria em Registro de Marcas e Patentes. Pesquisa e registro de marca e patente, direito autoral, propriedade industrial e intelectual.

sterndata’s picture

subscribe

sterndata’s picture

I've determined that my user's problem is due to the Creative AutoUpdate string. For the time being, I've just removed the string 'pda' from the test because I don't understand the above patch. What does testing for the absence of 'mozilla' do?

myared’s picture

Interestingly enough, this problem just happened to us today for the first time on a website that has been using Mobile Tools for several months. I refreshed the website cache and the correct theme is now being displayed again for IE8.

I believe that the problem is this:

99% of my IE8 people are fine. 1% may be using a version of IE8 that has had it's HTTP headers modified by another program. If that 1% hits the website and initiates the cache, then everyone sees the issue.

I'm going to be turning off the cache for the time being.

Any other ideas?

sterndata’s picture

Following another post upstream where it was pointed out that 'create update' triggered the test for 'pda', I removed that string from the test. OK, not the best approach, but it worked. I think that simply changing the test strings from things like 'pda' to ' pda ' might be helpful.

sterndata’s picture

This could be fixed by changing "pda" in the user agent test to " pda". I have to remember to do that with each update!

minoroffense’s picture

Status: Needs work » Closed (won't fix)

The 1.x branch is no longer supported. Closing.