1

I would like to open an URL via SSJS via an xp:button e.g. via:

var extCont = facesContext.getExternalContext();
extCont.redirect("myURL");

but this opens the URL in the same window/tab. I would like to open it in a new window.

I can not use the xp:link element because I want to have an icon in it. It seems my icon gets the css applied for an anchor element (blue color) and even the .btn-link class.

Malin
  • 697
  • 5
  • 21

1 Answers1

4

SSJS runs on the server, there there is no concept of the browser. You're SSJS needs to pass back client-side JavaScript in what it renders to the browser at the end of the request. Look at view.postscript() to post client-side JavaScript back to the browser.

Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33