Open URL with custom scheme in Forge app

We need to show a link to URI with custom scheme, e.g. <a href="myscheme:open?param1>My Link 1</a>. (When a user clicks such link, a browser opens a local, registered app.) A time ago, Atlassian has banned such links in the work item description field. So, we have developed a Connect App which displays a panel with the link we need. Now, when Connect apps are going to die I am unable to do same functionality with Forge:

  • UI Kit <Link> does not work, because it removes such href URI. Is it possible to allow <Link> to keep the specified URL somehow?
  • Custom UI renders the links right, but a click does nothing, because <iframe sandbox>prevents it.
    • Is it possible to set allow-top-navigation-by-user-activation or allow-top-navigation-to-custom-protocols for the sandbox? (See also older post Sandboxed iframe allowlist missing option)
    • I have tried bridge.router.navigate but it fails with “Error: link is invalid: …”. Is it possible to allow this method to open URL with custom scheme?
  • Or, is there any other way how to open URL with custom scheme?

PLEASE ATLASSIAN, DOCUMENT WHERE CUSTOM URIS ARE FORBIDDEN AND WHERE AND WHICH ARE ALLOWED.

(It’s fashion to use capitalization in diplomacy nowadays, so just trying if it would work with Atlassian.)

Note: it’s very frustrating it’s not documented what URLs are allowed on various Atlassian products and services and how to deal with custom URL schemes. And even more frustrating is, that if we find some solution, Atlassian changes that without notice later.

Update: I’ve debugged Custom UI bridge.router.navigate and there are a few strange things and some may be bugs. Two key functions are called: makeUrl and getLinkType:

  • makeUrl examines switch platform_add_support_for_custom_url_schemes, but it is false for the web UI. Is it possible to switch it on?
  • makeUrl returns undefined for URL for scheme without double slash (e.g. myscheme:open), but returns proper URL for scheme with double slash (e.g. myscheme://open). It’s because it prepends prefix https:// if URL has no double slash. Seems like a bug to me - either allow or deny both type of URLs.
  • getLinkType returns 'trusted' for URL with a trusted domain regardless of scheme. E.g. myscheme://atlassian.net is returned as trusted. Is it a bug or intentional?

Update:
After changes CHANGE-2717 and CHANGE-2794 it’s possible:

Note: bridge.router.navigate seems the most user-friendly solution to me.