Navigate to Next page By Right Clicking on Link

I have Created Links on my page. Links have method as Submit to Update Session variable and then navigate to Next page that will use Values from Session (i.e. No input parameters to next screen)

The problem is Normal click will behave properly but when i right click on link to open it in new tab it will not redirect it.

How to achieve this right click to navigate behavior.

mvp_badge
MVP

Hi Samarpit,


You can have a hidden button, with target _blank on the extended properties (to open on the new tab) and use Widget Click.

So, first create the hidden button / link:

And then use the Widget_Click action from RichWidgets to click the hidden button which triggers the opening of a page in a new tab:



Hope it helps.


Cheers,

João

mvp_badge
MVP

Hi Samarpit,

When you click on a link which has method set to submit, it actually sends a POST request. But when you right click and open it in new window/ tab, it will send a GET request to the link and because destination is not a screen or URL you will be redirected to a blank page.

So what you can do is, disable option to navigate with right click. For that you can use button instead of a link and style it as link (if you really want to show it as a link).

Is there any way to achieve this right click functionality to open that page with same functionality as left click??

mvp_badge
MVP

Hi Samarpit,

This is default browser behavior, it will always send GET request if you right click and open in new tab (or press ctrl + left click). Sending POST request on these actions is not possible.

This is not just for OutSystems but for any web application.

Hi João ,


Thanks for Reply.

I am looking to use Browser's right click and "Open in New Tab" Functionality. User don't want the link to open in new tab always.

Again my use case is

  • Link has Submit action to do some session updating.
  • When click on link it will navigate to next screen.
  • When user right click on link and tries to open the same link in new tab it fails to open that url

How to execute same screen action when user from browser click on open in new tab 

Rightclick.jpg

mvp_badge
MVP

Ok, now I understand better the problem.

Can you try to change the value of Click Method to Ajax Submit of your link?



João

Hi,


It is already ajax submit. it redirect to same page as https://domain/page#

mvp_badge
MVP

You mentioned the Method was Submit, not Ajax Submit.

Besides, if you're having the # on the URL it usually hints you have done a Submit (not AJAX submit) somewhere in the process which is causing you this issue.

Perhaps, you can share the OML or screenshots of your action to help understand better the situation you are reporting?

Oml i can't share because that is my offcial project. Ajax on link generate same URL of current page when open in new tab.

Hi samarpit,

Method 1: 

To achieve this via both On Click and Right Click navigate, Use Normal Link with Navigate Method  and in the destination Screen at the start of the Preparation change the session variable Value. 

Method 2: 

Have the Link with Submit Method as you specified , restrict the Right click navigation in the extended property of the link using OnContextmenu : return false;

Hope this Helps!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.