open in new tab does not work for link with onclick set for ClientAction ClientAction uses ServerAction to get URLsame tab is opened causing poor UX UItarget : "_blank" does not work
In OutSystems, when using a link with an onclick event set for a ClientAction that eventually retrieves a URL from a ServerAction and tries to open it in a new tab, you might encounter issues with the target="_blank" not working as expected. This is because opening a new tab generally requires immediate action in response to a user event, and using ClientActions with asynchronous ServerActions can disrupt this flow.
Steps to Open a Link in a New Tab
Create a ServerAction to Get the URL: Ensure you have a ServerAction that retrieves the URL you want to open in a new tab.
Create a ClientAction to Handle the Logic:
Set Up the Link with the OnClick Event:
did not get 3rd step of ur guide, plz explain in more detail
Add a DataAction on the screen to return the URL (e.g., GetURL.URL), then set the link's OnClick event to RedirectToURL and assign the URL as GetURL.URL. ( Note : If you want to open in new tab by default set attributes as target : "_blank" )
Hello,
The problem occurs because the property "target" add blank in a span, not in the default link, but you can try this:
1- add a client action with a URL parameter, call this action on click button
2- In the client action, add a JS script with the code below:
window.open($parameters.URL, '_blank');
I hope this can be helpfull