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

295
Views
JavaScript - get document (window) position relative to the browser window (or the screen)

Is there a way to get the position of the page / document (inner window) relative to the browser window?

For instance, there are properties on the window object like innerWidth / outerWidth which allow to get the width of the document renderer and width of the browser window respectively.

I could not find any properties that could determine position of the document within browser window. There's screenX, but it's position of the browser window relative to the screen.

Note that what affects the document position the most is devTools, which can be attached to either left, bottom or right edge of the screen. Also some browsers have sidebars. So it's not as simple as assuming that the docX relative to the window is 0 and docY = outerHeight - innerHeight

Is there any API available to get it?

Edit:

Example: Let's say the browser's tab and addressbar UI at the top is 150px in height and there's a sidebar to the left that has width of 200px. The position would be (200px,150px)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At this point the only solution found so far is using UIAutomation AutomationElement to get the object from the browser and grab top left from that.

I'm looking for a purely javascript implementation to get the browser top level document x,y relative to the screen.

The last version of GetAbsCoordinates in answers here: Get On-Screen Location of ...

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!