DonationCoder.com Software > Post New Requests Here
Need buttons to download a file and disable used button, how to do so in HTML?
OptimalDesigns:
I have several download buttons that are to be clicked only once, in a table. Each button has an ID = "btnXXX", how does one get this to work?
Each button, set of two, has code as follows:
--- --- <tr class="topic">
<td>Descript 1</td>
<td><a href="abc.ppt" download></a>
<button Id="btn1-1" class="button btn1"
onClick=“download_file()”>PPT</button></td>
<td><a href="abc.pdf" download></a>
<button Id="btn2-1" class="button btn2"
onClick=“download_file()”>PDF</button></td>
</tr>
This <tr> is duplicated some 10 to 20 times with different "Descript #", download file names, and button IDs. Need a function "download_file" that downloads a file and disables used button. There are two button IDs; btn1-# and btn2-#. Each of these buttons may individually be clicked on in each <tr> set. So e.g., 15 <tr> groups then 30 buttons for user to check from.
Ath:
How are you going to save the downloaded-state for each file? As a refresh/reload of the page will re-enable any disabled buttons...
If you want an indication of what's been downloaded already, then present the downloads as links, default browser behavior is to give visited links a different color from new links, similar to:
https://www.donationcoder.com/forum
vs:
https://you.never.visited.this/page
OptimalDesigns:
No saving of downloaded info.
4wd:
I would think you'd need to authenticate the user somehow, eg. user/pass, then you could use something similar as suggested here:
https://stackoverflow.com/questions/18867357/generating-unique-download-link-to-download-once-only
On user authentication, anything that relies on the client storing anything (eg. cookies), the IP, or software used for access (eg. browser fingerprinting), would be pointless as they can all be bypassed - so kind of falls back on the server to ensure single access only.
OptimalDesigns:
No, all my stuff is freeware including my math compiler :) No user/pass type stuff on my website.
Navigation
[0] Message Index
[#] Next page
Go to full version