0

We would like to use appAPI.openURL but in place of sending the data.selectedText I woould like to send the text of the element under the mouse. But I can't find the way of getting the mouse position. My idea was to add in the appAPI.ready the following

$().mousemove(function(event) {
myPositionX = event.pageX ;
myPositionY = event.pageY ;
}

And to have two global variable myPositionX and myPositionY which I could access in my background code to transmit as parameters of my URL. But this doesn't seem to work. Is what I'm doing crazy?

Alain BUFERNE
  • 2,016
  • 3
  • 26
  • 37

1 Answers1

1

You'll be pleased to note that your are not crazy but simply missed the selector required to attach the handler to the page. Hence, to make you code work, bind the mousemove handler to the document object per the following tried and tested code:

$(document).mousemove(function(event) {
    myPositionX = event.pageX ;
    myPositionY = event.pageY ;
});
Shlomo
  • 3,763
  • 11
  • 16