How to restrict V14 to single browser tab

Hi. Mr Swing-to-Vaadin guy here. My V14.11.9 app is 70+k lines, so I am not a novice, but many areas I know little about. I have searched forum and javadoc for 2 hours. I am sure my terminology is incorrect.

Currently my users can right-click a link, and a new browser tab opens.

How can I stop this?

Any clues much appreciated. Thx.

Hi, to prevent the context menu from opening altogether on right-click, you could do the following:

myAnchor.getElement().executeJs("this.oncontextmenu = () => false;");

Absolutely BRILLIANT. Easy, simple, perfect. Thank you Tomi.

1 Like

How strict do you want to be? There’s also the possibility that users might ctrl-click or middle-click links or just copy the URL from the address bar and using that in a newly opened tab. This is generally just the way web browsers work.