How to access mouse position of parent window in child popup window using javascript

346
November 22, 2016, at 4:11 PM

I want to develop a browser extension where if user click on extension icon, it will get a pop up with a input text box and on mouse move it will get current position of mouse pointer(X,Y) of screen, something like that:
X: 100 Y:50

Here i have created a mouse move event handler on my extension popup, something like that

document.addEventListener('mousemove', onMouseMove, false)
function onMouseMove(e) {
    x = e.pageX;
    y = e.pageY;
    document.getElementById("colorcode").value = "X: " + x + " Y: " + y ;
}

But it is showing popup's mouse position instead of user's page mouse position. Please suggest.

Rent Charter Buses Company
READ ALSO
Make cinematic-like intro on scroll

Make cinematic-like intro on scroll

I want to display a few words – like the example <h1> elements below – on scroll before the actual site appears. .

316
How to remove a marker from existing data on a map

How to remove a marker from existing data on a map

I have a datset of restaurants made in postgresql and they are shown on a map as markers with their information. .

403
Print PDF in Firefox

Print PDF in Firefox

How to print a PDF in Firefox?.

1342
Detect if you type inside a span tag

Detect if you type inside a span tag

Hello and thanks for taking your time to read this. .

303