Blaz
June 22, 2022, 6:42am
1
Hey all, I’m just playing with upgrading to manifest version 5 from 4.
The below buttons open an external URL in a web browser use to work, but now don’t when changed to V5.
They are called from within a element.
<sp-button quiet variant="primary" href="https://google.com">View Documentation</sp-button>
<sp-link href="https://google.com">Link Text</sp-link>
Looking at the v5 docs, I’ve also added this to my manifest but still can’t open a web link. I can get the <webview>
example working in a dialogue however so I’m at a loss.
"manifestVersion": 5,
"requiredPermissions": {
"webview": {
"allow": "yes",
"domains": "all"
},
"network": {
"domains": "all"
}
},
"permissions": {
"launchProcess": {
"schemes":"https",
"extensions": [ ".pdf", ".png",".jpg", ".psd" ]
}
}
https://developer.adobe.com/photoshop/uxp/2022/uxp/reference-js/Modules/shell/Shell/
In a nutshell - listen for the button click and then open browser/link with the above.
1 Like
Blaz
June 22, 2022, 7:24am
3
Legend, thanks Tim. That did the trick.
My code for ref:
const shell = require("uxp").shell //get
const documentationLink = document.querySelector("#documentationLink") //button selector
documentationLink.addEventListener('click', function () {
shell.openExternal("https://mywebsite.com") //open URL on button click
})
Interestingly, in manifest V4 I just used the SP-LINK element with href
and worked fine.
1 Like
JLD
January 10, 2023, 4:16pm
4
I tried this and it’s not working:
document.getElementById("jldWebSiteLink").addEventListener('click', function () {
console.log("Ok1");
shell.openExternal("https://www.jldoty.com"); //open URL on button click
console.log("Ok2");
});
I get both log outputs, but no web site comes up.
Are you sure to have the right permissions in the manifest.json?
JLD
January 12, 2023, 12:49pm
7
Got it working with:
"launchProcess": {
"schemes":
["https"],
"extensions":
[ ".pdf"]
}
in requiredPermissions in the manifest,json.