Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to open a download window without navigating away from the page

Tags:

javascript

What is the best cross browser way to open a download dialog (let's assume we can set content-disposion:attachment in the headers) without navigating away from the current page, or opening popups, which doesn't work well in Internet Explorer(IE) 6.

like image 480
mkoryak Avatar asked Oct 02 '22 10:10

mkoryak


1 Answers

This javascript is nice that it doesn't open a new window or tab.

window.location.assign(url);
like image 232
mozgras Avatar answered Oct 24 '22 10:10

mozgras