phpBB3 mobile device detection script

When we setup the phpBB3 mobile theme for the forum we edited the code to exclude a few large-screen devices. We noticed that the browser detection script is taken from non-commercial licensed junk code. The mobile detection script author wants $50/year for these 10 lines of highly resource intensive preg_match statements. Come on! That is totally incompatible with the GPL licensed mobile theme too…

We made a new public domain replacement in 10 minutes, we hope it will help any other forums using this theme. It is much more efficient, and totally free. It is almost a drop-in replacement, but it lacks device reporting (you won’t get the ‘from my android phone’ privacy invasion) and isn’t 100% correct for old devices.

We think it is *way* more efficient in two ways: 1. We don’t use pregmatch for simple matches ($50/year for this – really man?) 2. We get the common easy mobiles first, THEN we try to kick out any known desktops before doing more intensive mobile searching.

It will probably take some tweaking to get it right. If you find problems please let us know.

Thank you for supporting Dangerous Prototypes. Your purchases at Seeed Studio and our distributors made this open source code possible.

Documentation and download links are on the wiki: Replacement mobile browser detection for mobile themes

Join the Conversation


  1. Where is the option to switch back to the desktop theme? Generally speaking I find myself switching away from a websites mobile theme. While my two year old Nokia trails behind the Android and apple devices, with Opera mini the 5230 (and even the 6120c from 2007) I get a satisfactory mobile experience. With Opera mini, I have an option to view a site as designed for desktop or I can switch it to hide images or reflow for the device.

    Except when a website decides to reflow and apply the mobile theme for me without option. Some experiences with sites applying wordpress mobile themes reflowed the site with
    and in other cases links go missing. Until sometime earlier this year I kept getting kicked to DP mobile theme, leaving me with just the blog headlines – forcing a lot of navigation to load the full topic. HackADay is still broken in this way.

    Regarding the phpBB3 theme – it is actually quite okay, I can jump around my favourite sub forums with ease – unlike on some other sites I have been to. I do object to not having the option to switch back though.

  2. Thanks for the feedback, it’s great to hear from actual mobile users.

    For the blog: We recently switched to a new mobile plugin, and it includes the option to switch back to desktop if you like. I also got a mobile device for the first time and didn’t like the actual theme so I switched it to a new one and it includes the post summary without clicking through :) Let me know if there is anything else I can improve.

    On phpBB3 – I agree about the lack of switch. The reason I found this crap code was because I wanted to exclude my ipad from the filter. It needs a switcher link, and I will be sure to add one when we do the theme update. Also, the mobile theme runs the check every time, it should really be done once and stored in a cookie or session. That will be needed before the switcher will work. I find the phpBB main and moble theme to be usable but annoying. Jumping to unread posts is via one tiny icon. We are working on an update now to match the new blog theme that should be up later today.

Leave a comment

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.