Reputation: 189
I'm using EXTJS, i have a link, which is used to open a PDF file. The problem is that the pdf is not opened in the navigator, but it's downloaded ! The code i'm using is the following (which i found in stack ! )
var win = window.open(url, '_blank');
win.focus();
what i'm messing ?
Upvotes: 3
Views: 2408
Reputation: 384
Sample code of what I used:
{
xtype: 'button',
html: '<p class = "i-custom-right-menu-items-text">'+'Download Application
form'+'</p>',
cls: 'i-custom-right-menu-buttons',
width: '80%',
padding: '2 0 0 10',
iconCls: 'd-ball-modal-right-menu crtmenu',
handler: function () {
window.open('./resources/MYPDF.pdf', '_blank');}
}
Upvotes: 1
Reputation: 5856
Browser decides whether to open the file or show it inline (in the new tab) depending on received HTTP headers.
To download, server sends this header:
Content-Disposition: Attachment; filename="somefile.pdf"
To show inline, server sends this header:
Content-Disposition: Inline
Upvotes: 4