Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Automatically Downloading a File.
Sun, Dec 14 2014 5:59 PMPermanent Link

Steve Gill

Avatar

On some of my websites when a user wants to download a file I redirect them to a page that automatically downloads the file (they get prompted with a save dialog box).

It's done using the Refresh command. For example:

<META HTTP-EQUIV="Refresh" CONTENT="2; URL=/myfile.exe">

Is there a way I can do something similar with EWB?

It's for an internal website where the administrators want a file to download when the users go to a certain page.

= Steve
Mon, Dec 15 2014 4:32 AMPermanent Link

Matthew Jones

Steve Gill wrote:

> On some of my websites when a user wants to download a file I
> redirect them to a page that automatically downloads the file (they
> get prompted with a save dialog box).
>
> It's done using the Refresh command. For example:
>
> <META HTTP-EQUIV="Refresh" CONTENT="2; URL=/myfile.exe">
>
> Is there a way I can do something similar with EWB?
>
> It's for an internal website where the administrators want a file to
> download when the users go to a certain page.

So you want this to happen automatically? Creating a link for it
manually is easy of course with TLink. I've not tried this sort of
thing but my first thought would be whether you care about the current
page or not. You can tell the browser to go to a new page which will
wipe the current page (and your application). I forget the details on
this, but it isn't hard - was mentioned here somewhere, and if I recall
where I used it I'll find it!

If you want to keep your page, I'd look at the TPage component and set
the URL to the download location. Not tried that though, except for
showing proper content.


--

Matthew Jones
Mon, Dec 15 2014 10:00 AMPermanent Link

Walter Matte

Tactical Business Corporation


Add   Uses webDOM;

Code:

window.location.href := 'http://www.website.com/myfile.exe'
Mon, Dec 15 2014 9:05 PMPermanent Link

Steve Gill

Avatar

<< Add   Uses webDOM;

Code:

window.location.href := 'http://www.website.com/myfile.exe'  >>

Thanks Walter. That seems to work fine.

= Steve
Mon, Dec 15 2014 9:06 PMPermanent Link

Steve Gill

Avatar

<<
So you want this to happen automatically? Creating a link for it
manually is easy of course with TLink. I've not tried this sort of
thing but my first thought would be whether you care about the current
page or not. You can tell the browser to go to a new page which will
wipe the current page (and your application). I forget the details on
this, but it isn't hard - was mentioned here somewhere, and if I recall
where I used it I'll find it!

If you want to keep your page, I'd look at the TPage component and set
the URL to the download location. Not tried that though, except for
showing proper content.  >>

All good now. Thanks Matthew.

= Steve
Image