Hi, folks —
A few people have asked for simple examples using MobileESP. I’m most familiar with PHP and JavaScript, so I whipped up a few super basic samples.
These examples illustrate how easy it is to include MobileESP code in your web page, do a quick detect, then do something interesting. For example, some of the things you might want to do include:
- Turn on & off features.
- Optimize pictures, videos, and other multimedia content for a specific platform. For example, dynamically replace a Flash video with an H.234 video file for iOS devices.
- Show a platform-specific notice or ad. For example, “You’re on a Windows Phone 7 device? Download our new app!”
- Redirect a device to an alternate version of the web page.
The PHP and JavaScript examles follow the same user flow. Both examples are extremely simple and have a very basic setup: The user browses to a landing page that does a basic device detection. Then…
- If it’s an iPhone Tier device (including iPod Touch, Android, WebOS, etc.), it’ll redirect to a basic web page saying, “iPhone Tier.”
- If it’s any other mobile device (including BlackBerries, Windows Phone 7, PalmOS, and most feature phones), it’ll redirect to a web page saying, “Generic Mobile Page.”
- All other devices will fall through the above filters to land on a page saying, “Hi! I’m a Desktop page!”
Download the MobileESP samples for PHP & JavaScript.
See a live demo of the MobileESP samples in action.
Hi, I have implemented mobileexp as a package in MODx. I have implemented method B
Template Example B:
[[$my_mobile_template]]
[[$my_standard_template]]
But … I absolutely cannot see the mobile version on an iphone emulator. I can see it fine on my android (samsung galaxy ace). Also, the page is correct in a web browser.
Any ideas?
Thanks!
I am actually confused by what you say at top of the index.php file…
//SPECIAL NOTES:
// This is just a DEMO to illustrate usage of the MobileESP PHP code library.
// It is not necessarily a Best Practice to use an intermediary landing and detection page like this example
// when using PHP as a detection method.
How else could I redirect the user to different websites that I have set up for different devices? I really do not understand that note and it irritates me. Hopefully you can explain what it is trying to say and how else I could redirect the user. Thanks.
I would also like to know how i can include this in my sites home page instead of using a detection landing page. I have included the detection script in the head but when it tries to reroute back to my homepage, it ends in a infinite loop.
I have even tried include_once but with no joy.
Any tips?