var iframe = document.getElementById('iframe'); 
         iframe.onload = function(){
            iframe.contentDocument.onmousemove = function () {
            // console.log("iframe"); // Get the last mouse movement event after iframe is loadedCopy the code

Gets the iframe element

iframe.onload
Copy the code

The listening page is loaded

iframe.contentDocument.onmousemove
Copy the code

Adding event Judgment