DetectMobile-Talk

Download hangs

29-Aug-2010: The download hangs, When I click on TAR or ZIP all i get is a white page. Why did you not upload your recipe like everybody else? Martin Krischik

Downloads seem to work fine for me in Chrome and FF -- what browser are you using? You could also go direct to GitHub source and click the Download Source button on the top right.

I choose to store the source code for all my projects on GitHub, because:

  • it reduces the chances that I'll make a mistake when zipping files for upload to PmWiki, and thus removes the step of me testing each zip file to ensure I included all files correctly
  • it ensures that the code I'm using on my local repository is the same code users are downloading
  • it reduces the manual steps in my development cycle, making maintenance easier and less error prone
  • it reduces the risk that someone else will overwrite the zip file on PmWiki with corrupt versions
  • there is no reason that it should make any difference to a user of the cookbook where the file is maintained, as long as they are able to access the file

29-Aug-2010: 2 hours later: Works again. Guess github.com was down for an hour or so.

Parsing errors

28-December-2008: (Ian MacGregor) I installed this script as per your instructions above and was presented with this error:

Parse error: syntax error, unexpected T_IF in public/cookbook/detect_mobile.php on line 119

28-Dec-2008: Sounds very odd -- detect_mobile.php should only have 54 lines. Some of the lines are long -- did you open the file in a text editor that might have auto-wrapped them? DaveG

28-Dec-2008: Yes, I did open it in a text editor, which I do with all recipes just to check the code. However, I did not "save" the document so it shouldn't have been changed at all.

UPDATE: 20081230 - Dave, I tried it again using only command line tools to download, unpack, and setup the local config.php file and it's no longer yielding any errors. However, the recipe works fine on my website from a desktop computer, but doesn't switch skins when viewed on my mobile phone. I think the reason for this is that the mobile phone I have, Sidekick LX, uses the following user agent string:
Mozilla/5.0 (Danger hiptop 2.0; U; AvantGo 3.2)
I think the recipe is seeing that user agent string as 'mozi' which is also used in the Firefox web browser for desktop environments, thus the skin switch isn't happening. Is there a way to detect the "AvantGo" or "hiptop" bits of the above user agent string? I think that would help a great deal for Sidekick, Sidekick Color, Sidekick2, Sidekick3, Sidekick Slide, Sidekick LX, and Sidekick08 users. I'm planning to switch phones in the next few months to the T-Mobile G1 and the user agent string for that phone is:
Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2

But, being a Linux user myself, the best way to detect that user agent string is to detect either "Android" or "Mobile" as anything else will likely see browsers used under the desktop Linux OS as mobile when they aren't. Ian MacGregor

30-Dec-2008: I'll take a look tonight. I haven't updated the script for a while, so there's probably a few new browser types to add. DaveG

30-Dec-2008: I've upgraded the code. I can't perform an actual test, but the upgrade should accommodate the agent strings you've listed above. Let me know how it goes. Enjoy that G1 :) DaveG

This recipe is now working perfectly for me. Thank you for the update. Ian MacGregor

Talk page for the DetectMobile recipe (users).