Web Browser Asset - Open a PDF link

We received this question quite a few times recently so here is one solution to open a PDF link within a Web Browser asset in your Intuiface experience.

Important Note: this solution only works if you link is explicitly a PDF link, meaning the URL ends with “.pdf” or “.PDF”

How it works

The principle is to intercept when a user clicks on a link that leads to a PDF document in a Web Browser asset. When such a trigger is raised, then the PDF is dynamically loaded in a Document asset. We will use a conditional trigger to detect such a link.

On your Web Browser asset, add the following:

  • Add a “Link is clicked” trigger
  • Add a condition on the URL parameter of the “Link is clicked” trigger source. Use the “Ends with” condition and “.pdf” as the value.
  • Add a second condition and use “.PDF” as the comparison value, to handle both lowercase and uppercase files
  • Make sure you change the “ALL conditions must be true” into “ANY condition must be true

On the action side:

  • Add a “Change document” action on a Document asset you’ve previously added in the scene
  • Bind the “Document” parameter to the “URL” property of the “Link is clicked” trigger
  • Add an action to show the Document asset, or any group or layer that contains it. In the sample below, we use a group that also contains a black transparent rectangle as a background and a close button.

Sample

Download the sample here

Alternative solutions

If your web page doesn’t contain such an explicit link and the PDF is generated on the fly, using a kind of script in the page, the solution above will not work for you. Unfortunately, as of today, the Web Browser asset will not be able to detect such links.
If you are running a Player on Windows and need to open such websites, a solution could be to

  • Use a transparent player on top of a regular web browser (ex: Chrome, Edge, …)
  • Either let the web browser manage opening the PDF in same / new tab or
  • Monitor the “downloads” folder on the PC using a third-party tool, and trigger the proper things in Intuiface when a new file appears in that folder.
3 Likes