Javascript to download a file
Oct 12, 2023
By
MH Raidl
Hello!
I would like to set a trigger on a button that will download a PDF to the users "Downloads" folder. I don't want the trigger to open the print window but to directly trigger the download of the pdf file. The pdf file could be reached either via URL or embedded as an object in the storyline file.
I have searched e-Learning Heroes but didn't find any Javascript that triggers an automatic download.
Appreciate if anyone can help!
Marie
3 Replies
I understand your concern and I'm trying to help solve your Problem please implement the provided instructions I hope are helpful for you.
In your e-Learning tool (e.g., Storyline), add a button element to your slide.
Select the button, and in the trigger settings, choose to "Jump to URL/File."
Enter the direct URL of the PDF file you want users to download.
Test the button in your course to ensure it works as intended.
Now, when users click the button, it will trigger the download of the PDF file directly to their "Downloads" folder, without opening the print window.
Thank you!
Hi Samuel,
thanks so much for your thoughts on this. In Storyline 360 there is no "Jump to URL/file" in the trigger wizard. See print screen attached. There is "open URL/file", but that won't download the file. It will simply open it.
Hi MH, In case you are still looking, try this. I highlighted (see attached .png) the area you need to scroll down to, it's under "more" in the trigger wizard and named " Open URL/File".
Also check out this post: https://community.articulate.com/discussions/articulate-storyline/creating-downloadable-pdf-files-in-storyline-an-update-on-earlier-methods