-
11 Feb 2011 4:54 AM #1
PDF file downloads instead of showing in window
PDF file downloads instead of showing in window
Hi,
I'm trying to display a PDF in a new window and currently all my browser does is download the file. Here is the code I'm using;
Am I going about this the wrong way? Is this not possible?Code:this.window = new Ext.ux.MediaWindow({ id : 'PDFViewerWin', title : 'title', bodyCfg: { tag: 'iframe', src: '/path/to/file.pdf', style: 'border: 0 none' }, width : 600, height : 400, bodyStyle : 'position:relative; padding:0px;' });
-
11 Feb 2011 5:09 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
It's better to use an <object> or <embed> tag here instead of an <iframe> (also see the ux.Media user extension).
You could also fix this by changing your server to set the Content-disposition response header to 'inline' instead of 'attachment'.
-
11 Feb 2011 5:17 AM #3
Cheers for the reply Condor
When you say change the tag do you mean, tag: 'object' or tag : 'embed' ?
I don't think I can change the Content-disposition I'm afraid.
If I use embed I get an m is null on this.assert(m.height,height); which I'm assuming m is the PDF.
-
11 Feb 2011 5:29 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Try:
Code:{ tag: 'object', type: 'application/pdf', data: '/path/to/file.pdf' }
-
11 Feb 2011 5:40 AM #5
Well I'm getting a window now but it is no bigger than the title bar so it is a start
The file isn't downloading anymore
-
11 Feb 2011 5:46 AM #6
Right if I change from 'object' to 'embed' I get the window loads, is the correct size but the content is blank. I have checked taskmgr and I can see adobe running.
EDIT: If I use;
The PDF opens in a new tabCode:window.open('path/to/file.pdf');
-
7 Oct 2012 11:30 PM #7
Hi All,
I am tring same thing using ExtJs 4.0
i want to open a PDF in tab, following code works fine in FireFox and chrome.
It embeds PDF but it in IE it opens the 'download window'.
following is the code:
/****************************************************************************/
dashBoardTab.add({
title: 'Admin Help',
padding: '5',
id: 'adminHelp',
closable: true,
html: '<iframe src="../../../../Content/Help/FitChallengeOverview.pdf" width="100%" height="800px" frameborder="0" ></iframe>'
}).show();
/****************************************************************************/
Similar Threads
-
FYI: Very simple approach to JS-triggered file downloads
By Eric24 in forum Community DiscussionReplies: 9Last Post: 7 Jun 2012, 10:45 AM -
Dragging window without showing window proxy
By joe1chen in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 15 Nov 2010, 5:39 PM -
[SOLVED] BrowseButton/UploadDialog issue: still showing file input button
By dselkirk in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 1 Jun 2009, 5:18 AM -
Directory listing in data view causes file downloads
By para in forum Ext 2.x: Help & DiscussionReplies: 7Last Post: 21 Feb 2008, 12:09 PM


Reply With Quote