Hi,
I need to navigate to a new tab on click of a button. I know we can navigate to new tab using a link, but my requirement is to use a button. My app is reactive so there is no property to set navigate as in web app.
Thanks,
Gowtham
You can’t directly set target="_blank" on a Button in Reactive, but you can achieve the same behavior with a small Client Action and JavaScript.
target="_blank"
Typical approach:
On Click
GenerateURL
URL
window.open($parameters.URL, '_blank');
This will open the desired URL in a new browser tab when the button is clicked, while still allowing you to run any logic before opening the tab (calling server actions, preparing data, etc.). open screen redirect from client action in new tab
If your URL needs query parameters or special characters, use EncodeUrl() when building it so it’s properly URL‑encoded. open screen redirect from client action in new tab
EncodeUrl()
what do you mean when you say "my requirement is to use a button" ? Does it have to look like a button ? in that case, just style a container in the link. Or do you mean that you first have to do some logic in a screen action, and only then open a page in anoter tab ?
Hey @Gowtham yes as @Dorine Boudry said you can just use a link or a container and style it to look like a button, you will also need to use the "target" "_blank" that way the link will open a new tab instead of redirect like this:Also you can use a button, but you will need to handle the action and inside that action add a JS to open in a new tabAt least that's how I have found that works, you have some more options, but I think these are the easiest unfortunately not using the screen redirect, here are some previous post that I've found with the same topic that might help you toohttps://www.outsystems.com/forums/discussion/54897/reactive-app-how-to-open-an-external-site-in-a-new-tab/Andhttps://www.outsystems.com/forums/discussion/40272/display-link-in-new-tab-from-client-action/