从弹出窗口调用操作

问题描述:

我在打开弹出窗口时要面对.

I am facing when i am opening a popup.

<h:form>
<h:commandButton value="Submit" action="#{bean.submit}">
    <f:ajax render="popup" />
</h:commandButton>

<h:panelGroup id="popup">
    <ui:fragment rendered="#{not empty bean.url}">
        <script>window.open('#{bean.url}');</script>
    </ui:fragment>
</h:panelGroup>
</h:form>

我想在关闭此弹出窗口时调用一个操作

i want to call an action when i close this popup

第二次,我需要更改此弹出窗口的宽度和高度.

secondly i need to change width and height of this popup.

我们使用onbeforeunload挂钩在弹出窗口时从弹出窗口调用函数

<script>
        window.onbeforeunload = function() { 
            document.forms["showpdf"].elements["hiddenBtn"].click();
            }
    </script>
    <h:body>
        <f:view>
            <h:form id="showpdf">
                <iframe src="#{docProd.url}" width="100%" height="100%">     </iframe>
                <div align="center"><p:commandButton id="hiddenBtn"
                    onclick="#{docProd.resetUrl}" style="display:none"   /></div>
            </h:form>
        </f:view>
    </h:body>
    </ui:composition>