I need to get a cursor position on my page, but e.clientX/e.clientY
are undefined
when the cursor is inside the iframe
.
The iframe
is cross-platform, so I can't get its contents from my page, but I can modify its contents remotely though, make it post messages to parent window, for example.
How can I solve this, using pure Javascript, without jQuery or any other libraries?
Asked
Active
Viewed 1,087 times
1

Coffee
- 2,063
- 8
- 24
- 57
-
`e.screenX/Y` should do the trick, though you might get unexpected values from multi-screen systems. – Teemu Aug 24 '17 at 08:04
-
cover the `iframe` with a empty/transparent `div` with a higher `zIndex` and use mouse events from the div ;) – bluehipy Aug 24 '17 at 08:07
-
Hi, this link sould help you : https://stackoverflow.com/questions/7790725/javascript-track-mouse-position – SD3L Aug 24 '17 at 08:08