0

my extension is a frame that share the screen with any webpages. I have a button that calls this function(dot.js), but its printing over my frame too. How can i set the area allowed to draw the dots?

dot.js

function printMousePos(event, autor) {
    var div = document.createElement("div");
    div.style.height = "10px";
    div.style.width = "10px";
    div.style.backgroundColor = "black";
    div.style.position = "fixed";
    div.style.left = event.clientX+"px";
    div.style.top = event.clientY+"px";
    div.style.borderRadius = "50px";
  console.log(
    "clientX: " + event.clientX +
    " - clientY: " + event.clientY);
    document.body.appendChild(div);
}

document.addEventListener("mousedown", function(evt){
    printMousePos(evt, "autor1");
})

;

Thanks

Chris
  • 4,672
  • 13
  • 52
  • 93
  • This has nothing to do with chrome extension development. – user7771338 Mar 31 '17 at 20:24
  • sorry..i heard that chrome extension have some code restrictions, perhaps someone faced a similar problem doing this on chrome – Bruno Ropke Mar 31 '17 at 20:29
  • No, chrome extensions doesn't have any code restriction. The problem you are facing is probably your bad understanding of extension's [sandbox](http://stackoverflow.com/questions/9515704/insert-code-into-the-page-context-using-a-content-script) mode. – user7771338 Mar 31 '17 at 20:31
  • i agree, thats why im asking for help. – Bruno Ropke Mar 31 '17 at 21:14

0 Answers0