QUESTION DOES NOT ALREADY HAVE AN ANSWER (if you can provide code that works instead of googling my question and linking to whatever answer comes up for the sweet sweet internet points then I will accept it as an answer. But since I have already been to all of those questions don't pretend like they work unless you can provide actual code that you have tested)
If you just do
$(window).on("mouseout", function() { alert("OUT"); });
you can mouseout on the left or right side of the window and it doesn't fire the event. I made a jsfiddle here but it actually works fine because there is a border around the iframe.
So what is the best way to know if a mouse has left the window? I can put a 1px border around the page (composed of 4 divs). I can monitor x/y and tell if the mouse is on an edge. But ideally $(window).on("mouseout", foo) would tell me when the mouse has left the window.