call a4j:commandButton from javascript on window unload

后端 未结 1 1280
长情又很酷
长情又很酷 2021-01-16 18:39

I am not able to call a4j:commandButton click on window unload. my jsf code is here

1st the javascript in which i have window unload method

相关标签:
1条回答
  • 2021-01-16 18:59

    It's much cleaner to use jsFunction for this:

    <script type="text/javascript">
        window.onbeforeunload = function() {
            closeTime();
        }
    </script>
    
    <h:form id="pForm">
        <a4j:jsFunction name="closeTime"
                        action="#{controller.update}"
                        oncomplete="window.close()"/>
    </h:form>
    
    0 讨论(0)
提交回复
热议问题