common Posted October 26, 2010 Share Posted October 26, 2010 Hi I am trying to create a site that determines the device's screen size. Most mobile phone browsers does not have javascript, so to determine the width and height of the screen I cannot use Javascript. Does anyone know how i can test whether a mobile phone is used to visit the site and what that phone's screen resolution is, so that I can redirect it to the right folder. Thanks in advance Quote Link to comment Share on other sites More sharing options...
anups Posted October 26, 2010 Share Posted October 26, 2010 You can use .htaccess file basically you'll have to expand on that .. what's happening here is all in the rewrite condition and rule - so to take an example from another blog: RewriteCond %{HTTP_USER_AGENT} “Windows CE” [NC,OR] #Windows CE and Pocket PC RewriteCond %{HTTP_USER_AGENT} “NetFront” [NC,OR] #PalmSource WebBrowser 2.0 RewriteCond %{HTTP_USER_AGENT} “Palm OS” [NC,OR] #Eudora Web Browser for Palm RewriteCond %{HTTP_USER_AGENT} “Blazer” [NC,OR] #Handspring Blazer Browser RewriteCond %{HTTP_USER_AGENT} “Elaine” [NC,OR] #RIM Devices RewriteCond %{HTTP_USER_AGENT} “^WAP.*$” [NC,OR] #WAP Browsers RewriteCond %{HTTP_USER_AGENT} “Plucker” [NC,OR] #Plucker Offline download client RewriteCond %{HTTP_USER_AGENT} “AvantGo” [NC] #AvantGo Service RewriteRule ^index.php http://m.yourdomain.com/ [L,R] basically if the browser's user agent matches one of these strings, then the rewrite rule kicks in... it's not the most basic of concepts and rewrite stuff can be quite touchy, so it could be tricky to implement, but that's how you'd go about it... hope that helps a bit! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.