Use iframe to initiate file download

J

jef

I have a page (I call FileDownload" that intitiates a download of the
filename passed to it. I called it from another page via javascript:
window.open("FileDownload?file=blahblh");

it works fine but opens a blank browser window when it pops up the
download dialog (my target browser is IE).... someone suggested I use
an Iframe on the calling page so the blank browser window doesn't
appear. So i created a hidden frame on the page, but can't figure out
how to make it work..
I've tried both:

Iframe.src="FileDownload?file=blhablahb";
and
Iframe.location.href="FileDownload?file=blahb";

neither work...

I've tried to load other pages and that doesn't work eiither... so I
dont' think it has anything to do with the FileDownload page.

any help is appreciated.
 
R

RobB

jef said:
I have a page (I call FileDownload" that intitiates a download of the
filename passed to it. I called it from another page via javascript:
window.open("FileDownload?file=blahblh");

it works fine but opens a blank browser window when it pops up the
download dialog (my target browser is IE).... someone suggested I use
an Iframe on the calling page so the blank browser window doesn't
appear. So i created a hidden frame on the page, but can't figure out
how to make it work..
I've tried both:

Iframe.src="FileDownload?file=blhablahb";
and
Iframe.location.href="FileDownload?file=blahb";

neither work...

I've tried to load other pages and that doesn't work eiither... so I
dont' think it has anything to do with the FileDownload page.

any help is appreciated.

window.open("FileDownload?file=blahblh", "dummyfrm");
.......
<iframe name="dummyfrm"></iframe>
 
J

jef

Thanks for the reply.. but that didn't work..

.... I'm sure people do this all the time... I just need to know how to
set the URL of the conents of the IFRAME via javascript...

anyone?
 
R

RobB

jef said:
Thanks for the reply.. but that didn't work..

... I'm sure people do this all the time... I just need to know how to
set the URL of the conents of the IFRAME via javascript...

anyone?

Hi jef.

'that didn't work' isn't going to help much. Calling window.open(*url*,
*frame_name*) ~is~ one of the things people 'do..all the time' to set a
frame's url. Could we see what you're doing, exactly?

This is what I mean:

<quote>
Iframe.src="FileDownload?file=­blhablahb";
</quote>

What does 'Iframe' mean in that statement? Nobody reading that would
have any idea - and that might be the problem. Please be specific.
 
J

John

Thanks for the reply.. but that didn't work..

... I'm sure people do this all the time... I just need to know how to
set the URL of the conents of the IFRAME via javascript...

anyone?

document.getElementById('someID').src='FileDownload?file=blhablahb';

<iframe id="someID" ... >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top