-5

How to find the device width using the view port meta tag.

Also wants to display the device width in the console with

java script.

user1966260
  • 117
  • 1
  • 2
  • 5

1 Answers1

0

The viewport dimensions can be gotten through the window object:

var viewport = {
    width  : $(window).width(),
    height : $(window).height()
};

//can access dimensions like this:
//viewport.height

Though you won't always get perfect results, different devices behave differently and this gives the viewport dimensions, not the screen dimensions.

Refer this post more details on how to check the width of a data-role="page" element to find the device-width

Community
  • 1
  • 1
Gopinagh.R
  • 4,826
  • 4
  • 44
  • 60