I was reading this and about halfway down is a tactic to call a JavaScript function from the server side. Works almost perfectly but I would like to prevent the original page fr
Until you post the code you're running, you might not get a specific answer why the
is failing
Without any additional libraries however, a hacky way to execute client-side code is to use the PartialViewContext
. The mechanism is similar to what that tutorial recommends, only that you don't need any utility to achieve the same effect.
String javaScriptText = "window.open('"+actionUrl+"', 'popupWindow', 'dependent=yes, menubar=no, toolbar=no');";
FacesContext cxt = FacesContext.getInstance();
PartialViewContext partialCtxt = ctxt.getPartialViewContext();
partialCtxt.getExecuteIds().add(javaScriptText);