i using code redirecting new tab:
<script type="text/javascript">window.open('http://example.com');</script>
but run in google chrome shows "popup blocked" , stills on page. how can stop google chrome showing popup blocked adding javascript. can stop computer there option in chrome "always allow" if publish every audience cannot this.
you cannot "stop" chrome doing this, whole point of popup blocker.
, really, should not try create popups in first place, people hate it.
a new tab or window should opened result of user action (and else rightfully blocked), best way create simple link (<a>
) target="_blank"
.
but if i'm not mistaken, allowed create popups in browsers if code in question ran context of click
event handler (and few others, e.g. dblclick
, not things mouseover
) if event user event (as opposed event dispatched script).
if link not enough, try like
myelement.addeventlistener('click', function() { window.open('http://example.com'); });
this of course work if user clicks element, can promise you, if not click it, not want see popup.
demo: fiddle.
Comments
Post a Comment