I tested this on Firefox, Safari, and Chrome. When I changed the path to an absolute path, then the browser opened it in a new tab. download image from url javascript javascript download image javascript download file on click. However, Button 2 only downloaded the file if the path was relative. Answers related to download file from link javascript. However, Button 1 would download the file for file types that it couldn't open itself (for example. Button 1 opened the text file in a new browser tab.I made two buttons to test it out using two different methods: I noticed there were comments under a lot of the answers that said the browser would just try to open the file itself rather than downloading it depending on the file type. my_file.txt is the name you want the file to be called when it is downloaded.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |