Simulate onclick event problems in chrome
<p>I'm trying to simulate onclick event in a h:commandButton when I close my browser.</p>

<p>Here is my code:</p>

<pre><code>&lt;body onBeforeUnload='closingBrowser()'&gt;


function closingBrowser() {
    document.getElementById('main:commandButtonHidden').onclick();
    return false;
}
</code></pre>

<p>This javascript function call the function associated with my button which has this definition:</p>

<pre><code>&lt;h:commandButton id="commandButtonHidden"
   value="checkPasswords().Login" 
   onclick="javascript:checkPasswords();" actionListener="#{init.closingBrowser}" /&gt;
</code></pre>

<p>and checkPasswords():</p>

<pre><code>function checkPasswords() {
  alert("checkPasswords");
  return true;
}
</code></pre>

<p>This function has nothing interesting because what I want  is the function in my actionListener.</p>

<p>This works perfect in IE and FF, but not in chrome or Opera.</p>

<p>The alert always is fired in all browsers, but the actionListener NO, just in IE and FF, and it has no sense.</p>

<p>Somebody knows anything about this.</p>

<p>Thanks</p>
