Redirect to new tab/window

Splash Forums PrettyFaces Users Redirect to new tab/window

This topic contains 3 replies, has 3 voices, and was last updated by  Christian Kaltepoth 9 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18183

    DRY2
    Participant

    Please forgive this stupid question. Is there a way to redirect (using PrettyFaces) to open a new tab or window? Opening a new window happens on the client side through JavaScript so it seems like this is a no brain-er… but I figured I’d check with you guys in case there was more magic up your sleeves.

    Thanks,

    -DRY

    #22188

    This is not possible with an HTTP redirect, but you can change your link to use:

    <a href="mylink" target="_blank"> blah </a>

    That will open a new window when the link is clicked. If you need to perform some action when that happens, need to open the window to the new URL, and have that window perform the action instead of the link.

    #22189

    DRY2
    Participant

    Yeah i tired to use target on a JSF commandLink but we have to use PrettyFaces for the URL rewriting. So looks like I’m out of luck.

    Thanks.

    #22190

    So you want to open a new window as a result of a action method call invoked from a commandLink? I think this won’t be easy. Just some ideas that came to my mind:

    • Some frameworks provide the ability to push JavaScript to the client for ajax request. I think PrimeFaces supports something like this.
    • You could submit via ajax and hook into “oncomplete” to execute some JavaScript that does what you want.

      I hope this helps! :)

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.