Jump to content
Max Castril

How to identify mobile devices

Recommended Posts

Hi everyone

Nowadays, when one calls a website on a mobile device, the server will load an alternative web page.  E.g. if one calls www.examplewebsite.com on a mobile, then the page that one will see is something like www.m.examplewebsite.com.  How does HTML identify the type of device, beit PC, laptop, iphone, tablet etc. ??  I have read the w3schools pages on the subject and followed their advice, but am interested in at least modifying my CSS specifically ofor a mobile device.

 

Thanks in anticipation.

 Max

Share this post


Link to post
Share on other sites

HTML doesn't do it. It's usually done on the server side by analyzing the User-Agent HTTP header. 

On the client side, Javascript has that information available in the navigator.userAgent property, but if you're working on the client side you also have access to the screen size and window size.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...