Clicking <a> element with download link not working?

I have the following code in a custom component:

var a = document.createElement('a');
a.href = "" +; = 'download';

This is supposed to open the file save dialog to download the file referenced in the URL.

The click happens, Dev Tools Network tab tells me that the link is fetched, but no download window appears. I guess I might expect this within the main sandbox, but not in a custom component iFrame. And I do have All Popups to Escape... and Allow Links within the component... enabled.

I tried doing it by opening up a blank window and adding the tag there, and that does work as expected, but then leaves my user with a blank tab to close.