Forum Discussion

PaulGlenn's avatar
PaulGlenn
Community Member
26 days ago
Solved

Does Storyline allow users to right-click hyperlinks to bring up the browser context menu?

When right-clicking hyperlinks in published Storyline slides, we don't get a context menu (which allows people to, among other things, choose to open the link in a new window, or save the link address). I've observed that this is possible in Rise 360 courses. 

I've tested this across Chrome, Firefox, and Safari, with no luck. Is there a setting I'm missing somewhere?

Thanks in advance for any help!

  • You are right that the Storyline player doesn't treat text links like traditional HTML anchor tags as such, so any interactivity you want to have will all need to be managed on the slide as triggers.

    If you want to have the web link copied to the user's device clipboard for example you could set up an Execute JavaScript trigger when the element is right-clicked, and use the following JS:

    async function copyTextToClipboard(textToCopy) {
      // Check if Clipboard API is available and the writeText method exists
      if (!navigator.clipboard || !navigator.clipboard.writeText) {
        console.error("Clipboard API (writeText) not available.");
        return false;
      }
    
      try {
        // Attempt to write the text to the clipboard
        await navigator.clipboard.writeText(textToCopy);
        console.log("Copy Successful");
        return true;
      } catch (err) {
        console.error("Failed to copy text: ", err);
        return false;
      }
    }
    
    copyTextToClipboard("ADD THE WEB ADDRESS HERE");

     

6 Replies

  • Nedim's avatar
    Nedim
    Community Member

    FYI: There may be a bug with the Open URL trigger that’s worth noting. If you right-click a link and then click anywhere else on the slide, the link may open prematurely, even before it’s actually left-clicked.

    • Hi Nedim​!

      Thank you for pointing this out!

      I was able to replicate the same behavior on my end in a new Storyline file. I'd like our support engineers to have a closer look at this issue, so I've opened a support case on your behalf.

      They should be connecting with you via e-mail, once we have more insight to share!

  • Nedim's avatar
    Nedim
    Community Member

    I agree with Chris — it’s definitely easier to get a context menu on an image than on a link, for the reason he mentioned. To make it work with a link in Storyline, you’d need to create a separate anchor (<a>) element and append it in the DOM ancestor above the slide container. Then, you'd style it just like you would in standard HTML. This approach doesn't require an 'Open URL' trigger, but it does involve JavaScript.

    That said, it’s not something I’d dive into unless there were only a few links on the slide — otherwise, it can quickly become extra, unnecessary work and a bit of a time sink.

    Example:

    • PaulGlenn's avatar
      PaulGlenn
      Community Member

      Thanks so much for your reply. Our courses contain far too many to go coding for each one, but I appreciate the additional info!

  • ChrisHodgson's avatar
    ChrisHodgson
    Community Member

    You are right that the Storyline player doesn't treat text links like traditional HTML anchor tags as such, so any interactivity you want to have will all need to be managed on the slide as triggers.

    If you want to have the web link copied to the user's device clipboard for example you could set up an Execute JavaScript trigger when the element is right-clicked, and use the following JS:

    async function copyTextToClipboard(textToCopy) {
      // Check if Clipboard API is available and the writeText method exists
      if (!navigator.clipboard || !navigator.clipboard.writeText) {
        console.error("Clipboard API (writeText) not available.");
        return false;
      }
    
      try {
        // Attempt to write the text to the clipboard
        await navigator.clipboard.writeText(textToCopy);
        console.log("Copy Successful");
        return true;
      } catch (err) {
        console.error("Failed to copy text: ", err);
        return false;
      }
    }
    
    copyTextToClipboard("ADD THE WEB ADDRESS HERE");

     

    • PaulGlenn's avatar
      PaulGlenn
      Community Member

      Thanks so much for your reply. We're really looking for the browser context menu that allows a user to copy or save the link (as well as choose to open in a new tab/window, or access extension functionalities like Helperbird, Milanote, etc.) If I'm reading you right, it sounds like currently this just isn't possible with Storyline?