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 Answer 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



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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .