5

I need to run my custom protocol twice but it doesn't work the second time, I got this error ( Not allowed to launch 'cutomProtocol' because user gesture is required. ) I tried to find a solution but I did not find any!

Same problem with chrome, firefox and edge.

enter image description here

I need to see this popup twice enter image description here

window.location.href = 'my-protocol://${base64}';

and

customProtocolVerify(
      `my-protocol://${base64}`,
      () => {
        // successCb: Callback function which gets called when custom protocol is found.
        console.log('My protocol found and opened the file successfully..');
      },
      () => {
        // failCb: Callback function which gets called when custom protocol not found.
        console.log('My protocol not found.');
      }
    );

I tried with these two and didn't work

Clarification

I have a custom protocol.

My scenario:

  1. check if it's installed successfully (I'm using customProtocolVerify method) and that method makes the launch if the protocol is found
  2. run some APIs
  3. launch the protocol again

My problem:

Step 3 doesn't work, I have the error on the console that says " Not allowed to launch... " and of course I can't see my popup to open my protocol.

I'm asking for help to make step 3 work

Fatma
  • 51
  • 1
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 23 '22 at 10:05
  • I have the same issue, even though I have individual click events only opening a single URI – TeNNoX May 20 '22 at 16:48
  • I am also facing similar issue. first time it launches successfully but second time blocked. – Abhi747 Jun 15 '22 at 08:19
  • I found this article https://techcommunity.microsoft.com/t5/discussions/not-allowed-to-launch-lt-external-protocol-gt-because-a-user/m-p/3371418 that says this is bug in chromium – Abhi747 Jun 15 '22 at 08:22
  • here is bug report https://bugs.chromium.org/p/chromium/issues/detail?id=1096610 – Abhi747 Jun 15 '22 at 08:36

1 Answers1

0

The only way to bypass this "bug" is to ask the user twice (or in a loop) by showing a OK alert or some sort of user confirm box.

My solution:

OpenLinkInExternalApp(Link);
alerty.alert('', { title: '', okLabel: 'Open Link'  }, function () {
    OpenLinkInExternalApp(Link);
});

The above code will open the external app, then a OK alert will pop up, after clicking OK, I call the same code again. Do this in a loop if needed.

TIP: We guide our users to use split screen at this stage. This is where users can dock your web-app on the left and the external app on the right as an example.

Alert Box: We user Alerty.js https://github.com/undead25/alerty#readme

Lourens
  • 36
  • 1
  • 2