Include enable function in OmniFaces.Unload #326

hrkistiansen opened this Issue Nov 8, 2016 · 3 comments


None yet

2 participants


It would be nice if there was some hook to re-enable the unload-event, even after a non-ajax submit.

We have a use case where a submit action returns a dynamic link which opens in a new window. The unload-event on the origin page is disabled by the submit action, and we have found no obvious way to aviod this behaviour, or re-enable unload-event.


BalusC commented Nov 16, 2016


<h:form target="_blank">
    <h:commandButton action="#{omniViewScopedBean.submit}" />
BalusC commented Nov 16, 2016 edited

This is a nasty corner case. Another issue is that the view scoped bean of parent page gets unloaded when child window is closed while parent window is still open.

On the other hand, I'm not sure about your concrete functional requirement, but you should at least know that navigation by POST is a bad practice. Consider replacing <h:form target="_blank"> by <script></script>. Related links:


Thank you for the update. The corner is even darker than you think.

In IE 10/11 the browser treats and <a target="_blank" differently than <form target="_blank". But only if the parent window was opened by another window, and the user has the setting "always open pop-ups in new window", and the originating page uses PrimeFaces <p:poll. Using <form target="_blank" is the only way we have found to prevent the pop-up window to hide behind the originating window in this rather narrow corner case.

Of course, all is fine if the parent window is opened directly by the user, or the browser setting is anything but "always open pop-ups in new window", or parent page does not use a <p:poll, or using any other browser.

We tried any number of ways to remedy this window-behaviour, but in the end settled for submit, re-enabling the unload-event, and getting on with our lives. Hence the request for an official hook to re-enable the unload event :-)

@BalusC BalusC closed this in 5f99eac Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment