Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include enable function in OmniFaces.Unload #326

Closed
hrkistiansen opened this issue Nov 8, 2016 · 3 comments
Closed

Include enable function in OmniFaces.Unload #326

hrkistiansen opened this issue Nov 8, 2016 · 3 comments

Comments

@hrkistiansen
Copy link

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.

Regards,
Håvard

@BalusC
Copy link
Member

BalusC commented Nov 16, 2016

Reproducer:

<h:form target="_blank">
    <h:commandButton action="#{omniViewScopedBean.submit}" />
</h:form>

@BalusC
Copy link
Member

BalusC commented Nov 16, 2016

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>window.open(...)</script>. Related links:

@hrkistiansen
Copy link
Author

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

In IE 10/11 the browser treats window.open 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 as completed in 5f99eac Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants