PDA

View Full Version : mobile version


bertman
10-27-2010, 07:56 AM
Hello again friends,
I created a site using DW and it works fine..
Now I want a mobile version of this...
How do I do that if users enter the site from iphone etc. they see mobile version?

Ricky55
10-27-2010, 08:42 PM
You can do this with both Javascript and PHP. PHP is better though as it can't be disabled in the browser.

Check out this site, he has a couple of video tutorials on browser detection and creating mobile sites.

http://www.gotoandlearn.com/

Don't just stop with Apples devices though. Some of the more robust PHP solutions cover most mobile devices.

For a quick fix, this javascript code works for both the iPad and iPhone. Just insert this into the <head> </head> of your document.


<script type="text/javascript">
if((navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/iPod/i))) {
if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "http://www.welcomefurniture.co.uk/mobile";
}

if((navigator.userAgent.match(/iPad/i)) ||
(navigator.userAgent.match(/iPad/i))) {
if (document.cookie.indexOf("ipad_redirect=false") == -1) window.location = "http://www.welcomefurniture.co.uk/mobile";
}
</script>

bertman
10-27-2010, 10:30 PM
I will check this site thank you :)