none
Accessing Edge browser web page though edge Extension RRS feed

  • Question

  • Hi,

    I am new to the edge extension development.

    My task is to capture mouse cursor coordinates(X,Y) when I move over any web page when my edge extension is ON.

    For this I downloaded a sample web extension "color_changer" from https://github.com/MicrosoftEdge/MicrosoftEdge-Extensions-Demos/tree/master/color_changer

    Inside this extension project I am adding the mouse capture event inside "red.onclick" of popup.js.

    Now I am able to capture the mouse pointer coordinates on the popup dialog but not on the web page.

    Please guide me how trigger mouse pointer to capture the coordinates on the browser web page not on the popup page of my extension.

    Regards,

    Mayank A.   


    Thanks & Regards, Mayank Agarwal

    Friday, June 29, 2018 8:46 AM

Answers

  • Hi MayankAg,

    Try to refer an example below may help you to get co ordinates on web page.

    <!DOCTYPE html>
    <html>
    <body>
    
      <div id='info'></div>
    
    <script>
    var info = document.getElementById('info');
    
    // Creating function that will tell the position of cursor
    // PageX and PageY will getting position values and show them in P
    function tellPos(p){
      info.innerHTML = 'Position X : ' + p.pageX + '<br />Position Y : ' + p.pageY;
    }
    addEventListener('mousemove', tellPos, false);
    </script>
    <style type="text\css">
    * {
      padding: 0:
      margin: 0;
      /*transition: 0.2s all ease;*/
      }
    #info {
      
      
      right: 10px;
      background-color: black;
      color: white;
      padding: 25px 50px;
    }
    </style>
    </body>
    </html>
    

    Output:

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by MayankAg Thursday, August 16, 2018 9:45 AM
    Monday, July 2, 2018 6:49 AM
    Moderator