Been closely reading this: How to add a custom right-click menu to a webpage?
And so I have 2 HTML files, and 1 JS script. I don't use JQuery at all.
popup.html
<!DOCTYPE html>
    <head>
        <title id="title">Datajuggler</title>
    </head>
    <body>
        <script src="popup.js"></script>
    </body>
</html>
popup.js
var xhr = new XMLHttpRequest();
xhr.open("GET", "contextmenu.html");
xhr.send();
document.addEventListener("contextmenu", function(e) {
    // how do I draw the context menu here?
    e.preventDefault();
});
contextmenu.html
<div id="menu">
    <ul>
        <li><a href="http://www.google.com">Google</a></li>
        <li><a href="http://www.youtube.com">Youtube</a></li>
    </ul>
</div>
So it's very simple. I pull the context menu HTML from contextmenu.html, and I want this div to display whenever I right-click with the mouse (contextmenu event listener). But how do I show this div in place of the default context menu?
Thanks.
 
     
    