Linto
Linto

Reputation: 1282

Pop up blocker problem

I have the following html

<form action="http://www.google.com" method="post" name="first" target="_blank" id="first">
    <img src="loader.gif"  id="icon"/>
</form>
</body>
<script type="text/javascript">
$("#icon").click(function(){
document.first.submit();
})
//setTimeout("document.first.submit()", 1 * 500);

In this, while clicking the image, it will submit the form and new tab will open with 'http://www.google.com'

When i do the same functionality, on setTimeout or in page load, it will produce popup bloker, how can we avoid the pop up blocker

Upvotes: 0

Views: 1589

Answers (1)

betamax
betamax

Reputation: 14061

You can't. Popup blockers work by blocking popups that haven't been triggered by a users action. That is why it is working on click.

Unfortunately, you won't be able to get it to work without user interaction unless you get the users to explicitly allow popups from your site which I imagine would be quite difficult to convince them.

Upvotes: 3

Related Questions