Jump to content

Mobile Sites


common

Recommended Posts

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.