THE QUESTION ALREADY HAS AN ANSWER (if you can provide a code that works instead of googling my question and a link to any answer that is suitable for sweet sweet internet points, then I will accept it as but since I already had all these questions, not pretend they work if you cannot provide the actual code that you tested)
If you just do
$(window).on("mouseout", function() { alert("OUT"); });
You can click on the left or right side of the window and not fire the event. I made jsfiddle here , but actually it works fine because there is a border around the iframe.
So what is the best way to find out if the mouse has left the window? I can put a 1px border around the page (consisting of 4 divs). I can control x / y and tell if the mouse is on the edge. But ideally, $ (window) .on ("mouseout", foo) will tell me when the mouse left the window.
user2102611
source share