Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Is there a preferred JavaScript method for detecting screen size in a browser?

I have been looking at way to detect what screen size I am working with for a website. i.e. iPhone, desktop, tablet, etc.

So far I have come across quite a few methods. I am just looking to see if there is a preferred method, one that is more universal, etc. I realize there is rarely a one size fits all method. Just looking for the best.

If it makes a difference, the website will be a very minimalistic website. It's more of an add-on page for an app. So there will no bells and whistles on it.

window.innerWidth
...
screen.width 
...
document.body.clientWidth
...
window.outerWidth;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

window.innerWidth = the inner width of your current window (as you adjust the size it will give you the actual width of the window itself... ideal for responsive development).

screen.width = the size of your actual screen.

For application development, I'd recommend utilizing window.innerWidth.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!