function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kajal Chavan 9Kajal Chavan 9 

Open record in same window and on right click open in new tab or window

Hi,
I want to open record in same window from custom created related list and when right click on open and select open in new tab or window want to open in new tab/window. I have implemented for open in same window but getting "URL no longer exists" error on right click open.
below is my code snippet.

<apex:outputLink onclick="window.top.location.href='{!insolAccountId}{!ial.id}'; return false;"> Open
</apex:outputLink>

Any help would be appreciated.

Thanks,
Kajal
NagendraNagendra (Salesforce Developers) 
Hi Kajal,

Sorry for this issue you are encountering.

May I suggest you please give a try by using command link instead of output link as below and tweak it as per your requirement which should probably do the trick.
<apex:column headervalue="Customer Name"width="25%"><apex:CommandLinkonclick="window.open('/{!acc.Id}', '_blank'); return false;" >{!acc.Name}</apex:CommandLink></apex:column>
Hope this helps.

Kindly mark this as solved if the reply was helpful.

Mark this as solved if it's resolved.

Thanks,
Nagendra
 
Kajal Chavan 9Kajal Chavan 9
Hi Nagendra,

Thanks for the help.
But i want to open record in a same window on button click and on the same button, i want to open record in new window by right click --> open in new tab/window.

Thanks,
Kajal