Skip to content Skip to sidebar Skip to footer

Get Page Dimensions Using Javascript In A Content Page

I am trying to use a javascript method in a content page (Referencing master page) to get the current screen dimensions, and write it to a label. So far, I have had no luck. I tri

Solution 1:

Hello you can try with theses lines, you specific case is the third (clientHeight and clientWidth)

document.body.scrollWidth, document.body.scrollHeight// for the full size of the document
 
document.body.offsetWidth, document.body.offsetHeight//to the displayed size
 
document.body.clientWidth, document.body.clientHeight//customer for size displayed

Solution 2:

Have you tried following?

<ahref="javascript:alert
  ('Your resolution is ' + screen.width + 'x' + screen.height);">
     Click for your screen resolution </a>

Post a Comment for "Get Page Dimensions Using Javascript In A Content Page"