tags:

views:

17

answers:

2

If you visit the following URL in a web browser: http://sourceforge.net/projects/jpype/files/JPype/0.5.4/JPype-0.5.4.1.zip/download

it will show you a web page, and at the same time will send you a file attachment to download.

How they do this? One possibility would be that the web page had a redirection with javascript, and the browser stays in the same web page because the redirection is a file attachment and not a new html page. However, I didn't find such a redirection in that web page.

How they do that?

A: 

Use iframe set the download file location in the iframe's src attribute. I remember some sites used to open a small popup for the download and the popup closes as there are no html response (however, popups are these days blocked).

Ankit Jain
I don't see an ifram in the example of sourceforge I gave.
David Portabella
I understand that there are different ways to do that, but I am asking how it is usually done.
David Portabella
A: 

As soon as the page opens, using Javascript window.location='....', the page can access a second link, which sends a download.

Alexander
this is the javascript redirection I mentioned. However, I don't see that in the example of sourceforge I gave. I understand that there are different ways to do that, but I am asking how it is usually done.
David Portabella
Oh, they use Javascript, it's just too obfuscated to understand what's going on, but basically they use javascript to redirect the user. They may use it also to create an iframe, but there's no point in that once you use Javascript. Tried to find out exactly, but Google Chrome's profiler crashes when the download starts, and Safari itself crashes. It is simple actually, an address is loaded, next to the main page, and that can only happen in an iframe, or using Javascript. No other ways using HTML and JS.
Alexander