Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

296
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda