2

This is the code I'm using :

<a href="javascript:window.open(' http://eepurl.com/bQhLz1', 
   'Health Challenge: Week One', 'width=600,height=550 ');" ></a>

Not sure why my main page URL is redirecting once the popup opens. What can I do to fix this?

Demo: http://www.kaytivstheworld.com/2016/01/health-challenge-week-one.html

  • Works as it should for me? In chrome - which browser are you using? – StudioTime Feb 12 '16 at 08:07
  • [Don't use `href="javascript:"` or `onclick=""`.](http://stackoverflow.com/a/35093997/3853934) – Michał Perłakowski Feb 18 '16 at 22:01
  • Alternate duplicate targets: http://stackoverflow.com/questions/15622100/how-can-i-disable-href-if-onclick-is-executed or http://stackoverflow.com/questions/1607865/is-it-possible-to-stop-the-browser-from-following-the-link-when-the-onclick-of-t – cimmanon Feb 19 '16 at 00:39

1 Answers1

0

You should open window through onclick event and also return false to prevent default action

<a href="#" onclick="window.open('http://eepurl.com/bQhLz1',
'Health Challenge: Week One', 'width=600,height=550'); return false;"></a>
GuRu
  • 1,880
  • 3
  • 23
  • 32