How do you implement mobile browser detection? I was thinking of using this: http://detectmobilebrowsers.mobi How do I implement it?
I guess you just put the code below into a common file, say a config file for example or at the top of the php pages you want to detect a mobile on and then upload your generated file from that site. The generated file, will determine what actions to do if its a mobile, eg: redirect to a mobile equivalent page etc.. require_once('mobile_device_detect.php'); $mobile = mobile_device_detect(); PHP:
And that can be implemented on an existing website? By that I mean redirecting to a mobile version of an existing website. Sorry for the noob questions but I've been consistently avoiding anything to do with mobiles but finally decided to have a crack at it.
Correct... just for testing etc.. assuming you have a configuration file "config.php" place the above code into that, and for testing until you create mobile friendly pages, redirect to google.com or place the code into a test file test.php. Its the generated file from that site that will do all the work, its basically just looking for mobile browsers useragents and performers your predefined actions set in the generated file for the different mobile types.
require_once('mobile_device_detect.php'); mobile_device_detect(true,true,true,true,true,true,true,'http://mymobilesiteORmobilepage.com','http://mypcsiteORpcpage.com'); PHP:
I believe the author of that site/script is a user here (can't remember the username) perhaps if you search the relevant threads where that url is recalled you'll spot the user...and you can then get in touch. I'd assume you'd simply include the core function file and then do a function call, theirfore add the code morency kindly mentioned at the top of a global php file (such as a config?) or wherever you'd like the mobile detection to occur - changing the two urls accordingly (self explanatory which is for what)
You should look at PHP BrowserCap: http://github.com/garetjax/phpbrowscap made my life really easy at some projects, it might help you with Mobile Browser Detection.
Thanks. Looks pretty straightforward. I had a look as you suggested and he is indeed a member here. Have you seen this? Awesome! I can't believe nobody even commented.
I would'nt say its awesome as I've seen a few other scripts which do very similar functionality (and free) so not original, but admit its useful.