Jump to content

How to identify mobile devices


Max Castril

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

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...