Tom Red
Tom Red

Reputation: 91

Not allowed to launch '<URL>' because a user gesture is required

I have problem part code. I am developing an extension. I am trying to open link using my app.

var tab;
const context = chrome || browser;

if (tab.url.includes("youtube.com/watch?")) {
      context.tabs.update(tab.id, { url: "nameOfMyProgram:" + tab.url }); // Not allowed to launch 
      //'<URL>' because a user gesture is required. 
}

The problem occurs in the opera browser The first time it hits the web page, it works correctly. On subsequent clicks, an error "Not allowed to launch '' because a user gesture is required." This works correctly in the chrome browser. How can I solve this problem?

I have permission "tabs" in my manifest

Upvotes: 5

Views: 14291

Answers (1)

justdoingmyjob
justdoingmyjob

Reputation: 138

I had this exact problem with an external handler for Chrome. Since Opera is also chromium based, this solution could work for you, however, it seems like Opera is not providing the policy files necessary to enable the options I used in gpedit. Using these steps, you might be able to figure out how to download the policy files for Opera specifically, but I couldn't find it online myself.

Here is how I solved the problem on Chrome.

You'll need to enable the Allow access to list of URLs Option in the local group policy editor. Download the Chrome ADM/ADMX Templates zip from here: https://chromeenterprise.google/browser/download/?sjid=5017331163642805921-NA#manage-policies-tab and extract the zip.

Then open your Local Group Policy Editor. Browse to Local Computer Policy -> Computer Configuration -> Administrative Templates. Right click Administrative Templates and click Add/Remove Templates.

Browse to GoogleChromeEnterpriseBundle64\Configuration\adm\en-US from the extracted zip file and select chrome.adm

Now you should have the option that says Classic Administrative Templates in the Administrative Templates folder in gpedit.

From there, browse to Classic Administrative Templates -> Google -> Google Chrome and double click Allow access to a list of URLs

Enable the policy, and from there you can type in your program name you want to be able to launch external handlers without a user gesture. Here is an example screenshot of mine:

enter image description here

You'll want to copy down the program name from the error in the console log and enter that in.

My answer is specific to Chrome, but I'm sure if you can find the ADM policy files for Opera that will work for you.

Upvotes: 0

Related Questions