Search code examples
javascripthyperlinktabsconfirmation

Confirmation box not working on a link to another tab


heres the code of my link confirmation to another tab:

<a href="linksite" onclick="linktab()" target="_tab">Go to link</a>

 <script type'text/javascript'>
       function linktab()
       {
        return confirm('Are you sure you want to go to the link?');
       };
       </script>

i think the problem is the Target=TAB but i dont know how would i do that without closing the other site for loading purposes.


Solution

  • Instead of onload="linktab()" use onclick="return linktab()