0

I'm trying to link a div by javascript.

<div id="link-div">Click!</div>

$('#link-div').click(function () {
    window.open('http://www.google.de', '_blank') ;
});

If someone clicks on the #link-div the site should redirect to Google. The script works fine but the firefox popup blocker prevents the redirect. Is there an other way to link the div without a popup issue?

susanloek
  • 411
  • 1
  • 5
  • 19
  • 1
    I don't see any redirect. But popup blocker should not intefere with this syncronous window open. I guess, you really have trouble with some other code. Show the real code. – Alexey Ten Dec 15 '15 at 08:51
  • 3
    Why don't you use an ****** tag ? – Romain Dec 15 '15 at 08:55
  • Another stack using getJson and ajax methods...http://stackoverflow.com/questions/9514698/bypass-popup-blocker-on-window-open-when-jquery-event-preventdefault-is-set – yjs Dec 15 '15 at 08:58
  • Just built a test can and ran it with Firefox 44.0a2. I couldn't reproduce the problem (but as mentioned by others: Use a link if you want a link). – Quentin Dec 15 '15 at 09:05
  • The div is generated by javascript (Adobe Edge Animate). – susanloek Dec 15 '15 at 09:05
  • @susanloek it's working for me for both firefox & chrome in ubuntu – ARIF MAHMUD RANA Dec 15 '15 at 09:14
  • @susanloek I don't know how click event id handled by *Adobe Edge Animate* but if there is any delayed action regarding calling click handler, then this is expected behaviour to block opening popup. You have only issue on FF? Aren't you specifically blocking popup in FF user preference? – A. Wolff Dec 15 '15 at 09:32

0 Answers0