Hi folks,
I have a situation where I want to confirm a user is still allowed to edit a page when the page gets focus. This will prevent them from giving up editorship in one tab and then returning to edit in the original tab, or giving up editorship and then using the browser BACK button to return to the page where they could still edit. window.onfocus works perfectly for this in IE, FF, and Safari, but not in Chrome. Is this correct? Am I missing something obvious? Is there a workaround? Here is the code that works in IE, FF, and Safari:
$(window).bind('focus', function() {
$.getJSON("do_check.php", {id: 'foo'}, function(data){
if (! data.SUCCESS) {
$("#not_editor_dialog").dialog('open');
}
});
});
Note that the above binds the event with jQuery, but the jQuery-less version also fails in Chrome:
window.onfocus = function() {
etc.
};
Thanks!