Easiest way to open a download window without leaving the current page
To open a download dialog without leaving the current page or opening popups, use the following cross-browser JavaScript:
window.location.assign(url);
This method does not open a new window or tab and works well even in Internet Explorer 6.
By setting the content-disposition header to attachment, the browser will prompt the user to save the file instead of opening it in the browser. This allows you to download files without interrupting the user's current activity on the page.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3