Friday, September 16, 2011

How do I make my Website know that its being viewed by a mobile phone?

How do a make it so when you goto my website, it can tell that it is being viewed an a mobile phone and load the mobile phone version?|||you can have CSS specific to mobile.





%26lt;style media="handheld" src.....





you can also detect with JavaScript if the user is using mobile and redirect to a mobile subdomain using:





%26lt;script language = "JavaScript"%26gt;


var ce = navigator.appVersion.indexOf("Windows CE")%26gt;0;


var palm = navigator.appVersion.indexOf ("Palm OS")%26gt;0;





if (ce || palm) {


location.href='mobile.yourSite.com';


}


%26lt;/script%26gt;

No comments:

Post a Comment