最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Not allowed to launch cutom protocol because a user gesture is required - Stack Overflow

programmeradmin3浏览0评论

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.

I need to see this popup twice

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

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.

I need to see this popup twice

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

Share Improve this question edited Mar 23, 2022 at 13:12 Fatma asked Mar 23, 2022 at 8:03 FatmaFatma 911 gold badge1 silver badge3 bronze badges 6
  • 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 Bot Commented Mar 23, 2022 at 10:05
  • I have the same issue, even though I have individual click events only opening a single URI – TeNNoX Commented May 20, 2022 at 16:48
  • I am also facing similar issue. first time it launches successfully but second time blocked. – Abhi747 Commented Jun 15, 2022 at 8:19
  • I found this article techmunity.microsoft./t5/discussions/… that says this is bug in chromium – Abhi747 Commented Jun 15, 2022 at 8:22
  • here is bug report bugs.chromium/p/chromium/issues/detail?id=1096610 – Abhi747 Commented Jun 15, 2022 at 8:36
 |  Show 1 more ment

2 Answers 2

Reset to default 1

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./undead25/alerty#readme

Share this Solution for you c:

●The first problem: 'There were a pop-up dialog every single access'.

Hkey[AutoLaunchProtocolsFromOrigins] allow me to trigger url potocol without pop-up dialog.

●The second: When I try trigger multi url potocol in same time. There was an error 'Not allowed to launch ... because user gesture is required.' in browser F12 console. (If trigger multi url potocols in same time, every mand after 2st were stocked in url erea.)

Hkey[DoNotSilentlyBlockProtocolsFromOrigins] allow me to trigger url potocol in same time.

Find out your Edge Policy and try this below HKEY...

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge]
"AutoLaunchProtocolsComponentEnabled"=dword:00000001
"AutoLaunchProtocolsFromOrigins"="[{\"allowed_origins\": [\"*\"],\"protocol\": \"<<<YOUR_POTOCOL>>>\"}]"
"DoNotSilentlyBlockProtocolsFromOrigins"="[{\"allowed_origins\": [\"*\"],\"protocol\": \"<<<YOUR_POTOCOL>>>\"}]"

● Steps:

1.replace '<<<YOUR_POTOCOL>>>' to your potocol name and register that.

2.update setting

(1)reboot client side puter.

OR

(2)goto 'edge:\\policy' in edge url erea. and click the 'Reload Policies' button.

Ichiren best regards.

发布评论

评论列表(0)

  1. 暂无评论