Open link in browser

Is there an easy way to open a link in browser when a plugin is done running? I tried this and no dice.

shell.openExternal(“http://google.com”)

shell.openExternal("http://google.com"); should work.

Did you import it with

const {shell} = require("uxp");

before using your code snippet? Since it is a part of the uxp module, you need to import it first. After that, you can use it like this:

const {shell} = require("uxp");
shell.openExternal("http://google.com");

If not: That’s how you can do it (cf. https://adobexdplatform.com/plugin-docs/reference/uxp/class/Shell.html?h=openexternal).

If the problem persists, could you please share any errors that might get shown in the developer console here, so we can better help you? Thank you very much in advance :+1:

Hope this helps,
Best,
Pablo

3 Likes

@pklaschka, did it work for you? I’m running the code:

import * as uxp from "uxp";
try {
  await uxp.shell.openExternal("https://google.com");
} catch (ex) {
  console.log(ex);
}

and I’m getting the error: Shell::openExternal: Error loading the url.
Xd version is image
BTW documentation for that method doesn’t include return type which is Promise.

UPD: after several restarts it start working.

Strange. Maybe a UWP thing. That said, we’re delegating to the OS, so it’s surprising that it failed to load the web page. If it happens again, let us know.