Over a million developers have joined DZone.

Javascript Tweak To Open URL Either In A New Window Or New Tab Based On User's Choice

I am facing an issue where a link on my website opens in a new window if you simply click on it. However, if you right click and say open in new window or new tab, it opens the same window (URL) again from where the link is clicked.

Self Service Option is a link and the JSP calls a function getSelfServSite() when the link is clicked. This is how the code flows in my case

function getSelfServSite()
   // this is because the URL is configurable

function getToTheLink(url) 
   window.open (url, "currentWindow", "");
What am I doing wrong. I want it to go to the right link no matter how the user click it.

Please advise. Thanks

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}