Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to listen to focus event of a window with a browser?
  2. <?xml version="1.0"?>
  3. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  4.  
  5. <window width="640" height="480"
  6.     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  7.     onload="">
  8.  
  9.     <script>
  10.         <![CDATA[
  11.             function onfocus() {
  12.                 dump("FOCUSED!n");
  13.             }
  14.             window.addEventListener("focus", onfocus, false);
  15.         ]]>
  16.     </script>
  17.  
  18.     <browser id="gmail" type="content" src="http://gmail.com/" flex="1" />
  19.     <button label="click here to remove the focus from the browser"/>
  20.  
  21. </window>