I see numerous questions along these lines, but they all require checking the document object. I’m trying to do this from a cross-domain iframe, so I don’t have access to top.document. Any way to do with with the window.top object?
UPDATE: see my answer below
Pretty sure the answer is no. Such things are the responsibility of the document and not the window.
I found this answer in another question, which uses window.onfocus and window.onblur. Unfortunately browser security seems to prevent attaching events to window.top.onfocus/blur….