Button trigger to open document will break if document has moved *and* Resources button is exlcuded from Player

Jul 31, 2023

Hi,

We have performed some tests and possibly discovered a condition under which button triggers to open documents will unexpectedly break.

Our test setup was as follows:

  1. In a blank course document, add a trigger to download/open a PDF from a button click.
  2. Add the same PDF under Resources in the Player. Ensure the Resources button is visible in the Player.
  3. In your device's file explorer, move the PDF so it is no longer accessible at the location that was used to import into Storyline.
  4. Publish the course.
  5. Repeat the above steps but exclude the Resources button from the Player.

We have found that...

  • If the Resources button is included and the location of the document has changed prior to publishing, the button trigger to open the PDF will work.
  • If the Resources button is excluded and the location of the document has changed prior to publishing, the button trigger to open the PDF will not work. It will open a browser tab with the usual Chrome message: "Your file couldn't be accessed". There is also no warning that the file is missing during publishing.
    • If the trigger is updated to the new PDF location and the course is republished, the button trigger will work again (no need to add the Resources button back in the Player).

We have found it does not matter what order you test the above two scenarios. We can reproduce the problem simply by adding a trigger to open the doc, then moving the doc, then publishing.

We would be very grateful if someone can reproduce this behavior and confirm if it is expected.

Many thanks in advance.

3 Replies
Jose Tansengco

Hello Developer Ignition,

Happy to help!

I believe this could be explained by the key differences between the two methods you are using to add the PDFs to your course. 

If you used the attach file as a resource method, then a local copy of the file is saved for the course even before you proceed to publishing it, which means you can add a PDF as a resource, delete the original, publish your course and the resource will still work as intended.

With that being said, can I ask if you are encountering any issues with your resources or PDF files? Note that errors are normal for a course that tries to access a PDF file hosted on an external site if the file has been moved or is no longer available. 

Developer Ignition

Hi Joe,

Thank you for your response.

I can accept that the “Open URL/File” function expects the document to be hosted online.

However, I must emphasize the inconsistency…

The “Open URL/File” function will attempt to bundle the file inside the published package. This will happen successfully if the file has not moved before publishing. Furthermore, upon inspection of the JavaScript that is in the published package, the path to the file is re-written to: "url":"story_content/external_files/MyFile.pdf".

To clarify, I would like the file to get bundled.

The issue is that when I give the .story source file to an external agency, the file path breaks and the file is not bundled in the published package produced by the external agency. It is only bundled when I publish it.

I feel this inconsistency should be resolved with either:
1) it’s always bundled
2) it's never bundled
3) a warning is shown if the file is missing

For me, option 1 is most preferable, then option 3. Option 2 is the least preferable for me.

If you have any questions, please do not hesitate to ask.

Jose Tansengco

Hello Developer Ignition, 

Thanks for the additional information. Yes, I can confirm that no file validation happens for “Open URL/File” triggers, but this sounds like it would be a great feature to have.

Right now, the best solution would be to first add your PDF as a resource and then directly link to it using an “Open URL/File” trigger. This way, even if you share your .story file with another author, any file that is targeted by the “Open URL/File” triggers will always be accessible since they've already been added as a resource. I've attached a sample file which has a PDF included in it for your reference.