Prevent Chrome From Blocking Download

The 2012 /r/Chrome Survey Results (by /r/SampleSize) are in! All about developments relating to the Google Chrome and Chromium web browsers, Chrome apps and extensions, ChromeOS, and Chromebooks.

On my website there is a button that just used to call a function that calls window.open, however, recently an adjustment was needed to do a server-side check before the popup was opened.

Ever since the code was added that does the AJAX call, browsers blocks the popup, that is opened in the success callback of the AJAX call. I read that browsers might block the popup if it's not called by a user click event, so I tried setting the AJAX request to async: false, which solved the problem in Firefox, but Google Chrome still keeps blocking my popup. Is there any way to get around this?

I could move the server-side check to the page that gets opened in the popup, but I'd like to do it before opening the popup, if possible.

Code:

Example response body:

AistinaAistina
Prevent chrome from blocking downloads

6 Answers

Yes, popups should be a direct result of a user action. Doing them in ajax callback will not do the trick. Also, using async:false is bad - in FF it is known to block the whole browser. Think of some other way to do the check:

  • it could be the first thing you do in the popup
  • you can open the popup on click and manipulate it later when the callback fires
  • you can require the user to click again some button to trigger the popup (probably the worst solution)
  • you can do it on page load
Emil IvanovEmil Ivanov

Following up on Emil's excellent answer, 'you can open the popup on click and manipulate it later when the callback fires'. I used this implementation.

New code here

end new code

gabegabe

You can open a window that is not blocked just under the onclick event, if you open it on ajax call it is considered popup. However I used this method with success for some time to open a popup and not be blocked.

Cooper M.Cooper M.

In my case the window.open was launched inside a promise in angular, which turned the popup blocker on, my solution was:

browserService:

this is how you can open a new tab using the promise response and not invoking the popup blocker.

How To Prevent Chrome From Blocking Download

DavidDavid

The previous solution did not work for me, but I based on it and used named window.

Gilad FGilad F

I use this method:

  1. Redirect to the same page with download url added as parameter:
  1. Detect this parameter on page initialization and redirect to download:
Fedir TsapanaFedir Tsapana

Not the answer you're looking for? Browse other questions tagged javascriptgoogle-chromepopuppopup-blocker or ask your own question.

The Download Now link will redirect to the extension page. To install the extension directly, click on the install button on the page.

Chrome Is Blocking My Download

Oh, sweet, sweet Adblock. We loved you in Firefox, and Adblock for Chrome is just as wonderful. Who knew that one little browser add-on could make surfing the Internet so much more enjoyable?

Adblock does exactly what its name implies: it blocks ads. Pretty much all of them. Banner ads? Yes. Those crazy annoying Flash ads that seem to be popping up everywhere? You bet. Facebook ads, Google ads, pop-up ads? Check, check, and check. Using the Internet with Adblock is oddly peaceful; all you see is the content you're looking for, and not all the distracting clutter that we've grown accustomed to. A small notification in the bottom right corner of the screen lets you know when a pop-up has been blocked, and you can choose to have Adblock stop blocking pop-ups from individual sites if desired. Using Adblock also results in the practical advantage of faster page loads, which is always a plus. This extension offers plenty of options for customization, allowing users to specify domains for which they don't want ads blocked, select specific filters, and submit ads that Adblock missed. Like most browser add-ons, Adblock doesn't have a Help file, but it's pretty straightforward. We found Adblock to be very effective and easy to use, and we highly recommend it to anyone seeking a smoother, less cluttered Web-browsing experience.

Prevent Chrome From Blocking Download On Mac

Adblock for Chrome is free. It installs and uninstalls without issues. We recommend this add-on to all users.

read more +

Prevent Chrome From Blocking A Download

What do you need to know about free software?