Lately, a lot has been made of the small and powerful Dojo Base, as a stand-alone JavaScript library that handles the basic needs of most Ajax developers. But recently I’ve been working on a difficult project, and was saved by some brilliant work done in Dijit.
Posts Tagged ‘focus’
Dijit Diamonds: Focus
Thursday, November 6th, 2008The Cross-Browser Window Focus Blues
Monday, October 13th, 2008So your cool new app is perfect, but you want it to lock the user out when the browser hasn’t had focus after 15 minutes? Well that’s easy you think, I’ll just connect to the document’s blur and focus events and be good to go. You quickly add a little bit of code to your Dojo widget:
dojo.connect(dojo.doc, "onfocus", this, "onWindowFocus");
That should do it you’d think. Launch your app with Firefox and everything is great, easy enough. The same is true with Safari. After reluctantly firing up your Virtual Machine to test Internet Explorer 6, much to your dismay, onfocus events are immediately followed by onfocusout events. You feel the harsh reality that IE6 is going to suck away a bit more of your life.

