Forum Discussion

Muzammil2's avatar
Muzammil2
Community Member
4 months ago

❓ Storyline JavaScript PDF Download Error: “The file has been moved or deleted.”

Hey Everyone, I’m trying to add a download button inside my Storyline 360 course that lets learners download a Word and PDF documents before they can proceed.

I followed these steps:

  1. Inserted my PDF into the Resources / WebObjects section.
  2. Published the course (SCORM).
  3. Located the published folder: story_content/WebObjects/8DAu1K9vF5/MyDoc.pdf.
  4. Added this JavaScript trigger to my slide:

var player = GetPlayer(); // Path to PDF inside story_content/WebObjects var filePath = "story_content/WebObjects/8DAu1K9vF5/MyDoc.pdf"; var link = document.createElement("a"); link.href = filePath; link.download = "MyDoc.pdf"; document.body.appendChild(link); link.click(); document.body.removeChild(link); player.SetVar("DocumentDownloaded", true);

⚠️ The Issue

When I publish and run the course, clicking the button gives this browser error:

Error: “The file has been moved or deleted”

Even though the PDF is physically inside the story_content/WebObjects/8DAu1K9vF5/ folder.

How can I fix this error?

5 Replies

  • Have you tried this without JavaScript, using just the download file trigger?

    • MaryGregg-f1028's avatar
      MaryGregg-f1028
      Community Member

      I have a similar issue this morning.  I tested the process last week and it worked.  I am using a button with a trigger to the URL of the PDF loaded in the Resources of my Player.  According to the directions, I published the course to Review 360 and opened the PDF from the Resources.  I then copied the link starting with the story_content/ and pasted to the Trigger OpenURL/file when the user clicks the button.  I now get this error: 

      This XML file does not appear to have any style information associated with it. The document tree is shown below.

      <Error>

      <Code>AccessDenied</Code>

      <Message>Access Denied</Message>

      <RequestId>DRVFER5YXHE0VGDN</RequestId>

      <HostId>llf2UYqE2KAyCn4GcqJx/xAEinsz6GIFLyrbl7Y40eHs8pke9Vsz5s+6/rONt+CbpIITWy/XX/ep15v595LfSkRBE+0pTj6/</HostId>

      </Error>

  • I found a different set of directions here that did work.  https://community.articulate.com/discussions/discuss/actions-based-on-opening-resources/1228136/replies/1228956