DelphiFAQ Home Search:
General :: Programming :: JavaScript
Code snippets to add functionality to your HTML pages, preferably cross-browser.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How can I start two simultaneous downloads with one link?

Question:

I need to ensure that a user downloads two files and want to start both downloads once the user has clicked on 'Download now'. I cannot pack both files in one archive. How can I achieve this?

Answer:

This is a good application for IFRAMEs. (Or regular FRAMEs). Have one (I)FRAME for each document and write a function that sets each frame's location to one of the downloads.

If you want to go fancy, you can even create those IFRAMEs dynamically on the fly with insertAdjacentHTML and setting their SRC parameter to each file's URL.

Otherwise simply provide the two IFRAMEs somewhere small and not noticable at the bottom of the page and dynamically set their SRC attribute.


Generated 12:01:53 on Sep 19, 2017