After some actions on my site user can donwload file. First, I ask user: "Would you like to download file". This is modal dialog created with fancybox. There are buttons: Yes and No. When user clicks "Yes" I want to open new tab in browser and show standart save file dialog. I have this code:
$(document).on('click', '#agentAcceptSave', function () {
alert(1);
window.open = '/ticket?orderId=' + $('#agentOrderId').val();
}
But, new tab not open and url not calls, but alert is showed. Where is a error?
You can open a new tab on clicking a link by specifying target="_blank" property in your <a> tag. On this page, you can then display the counter before display the download link.
In most browsers, clicking on the link will open the file directly in the browser. But, if you add the download attribute to the link, it will tell the browser to download the file instead. The download attribute works in all modern browsers, including MS Edge, but not Internet Explorer.
href = data . This will cause the browser to download the file.
I tried this code and it worked for me:
$(document).on('click', '#download', function() {
window.open('http://www.google.com');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With