fix(webiew): incorrect condition for window.open js script
Some checks failed
Continuous integration / test (push) Has been cancelled

This commit is contained in:
Tim 2025-02-24 00:28:56 +01:00
parent ae5e8eb0e4
commit 8ef0f079b6

View file

@ -139,18 +139,19 @@ impl PartialUi for WebView {
}catch(e){}
window.open = (url) => {
if (typeof url === 'string' && URL.canParse(url))
if (typeof url === 'string' && URL.canParse(url)) {
try {
const message = {
id: 1,
args: ['open-external', url],
};
window.chrome.webview.postMessage(JSON.stringify(message));
} catch(e) {
console.error('Failed to post message');
}
} else {
return console.error('Not a valid URL string');
try {
const message = {
id: 1,
args: ['open-external', url],
};
window.chrome.webview.postMessage(JSON.stringify(message));
} catch(e) {
console.error('Failed to post message');
}
};