2

I'm using an anchor tag

<a href="#" onClick="javascriptMethod();">asdasdasd</a>

This javascript function dynamically decides on the page to open. Works all right on click. But when I right click and Open in new tab, it just shows me a page with "URL No Longer Exists"

Any suggestions?

1

This is nothing to do with Salesforce / Visualforce.. its purely javascript related..

see these discussion on how to handle non left mouse clicks in your onclick event handler

https://stackoverflow.com/questions/17167938/js-onclick-not-executing-when-we-opening-right-click-open-in-new-tab

https://stackoverflow.com/questions/17157455/left-click-to-activate-onclick-and-right-click-to-activate-href

so what these discussions suggest you is to check if its left click then do your action.. otherwise prevent the default action (don't open the context menu)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.