0

I need to open a download page in a new tab, and after the download is complete, it should close and will come back to parent page automatically. But, I do not want the user to stay in the download blank page. I just want to open a download tab and get the user back to the application's tab.

I've tried,

let win = window.open('http://google.com', '_blank');

win.opener(); // x

win.parent(); // x

win.opener.parent.focus(); // x

window.focus() // x

but nothing works, is it possible to do that? If so, then how?

(I need to support IE9+, FF and chrome)

Draken
  • 3,134
  • 13
  • 34
  • 54
Expert wanna be
  • 10,218
  • 26
  • 105
  • 158
  • Possible duplicate of [easiest way to open a download window without navigating away from the page](http://stackoverflow.com/questions/1066452/easiest-way-to-open-a-download-window-without-navigating-away-from-the-page) – pwolaq Sep 08 '16 at 09:00
  • From suggested answer: `window.location.assign('http://google.com');` – MarcoS Sep 08 '16 at 09:02

1 Answers1

1

You can use window.location.assign(downloadPageUrl);

callback
  • 3,981
  • 1
  • 31
  • 55