mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-01-11 22:40:32 +00:00
fix(webiew): incorrect condition for window.open js script
Some checks failed
Continuous integration / test (push) Has been cancelled
Some checks failed
Continuous integration / test (push) Has been cancelled
This commit is contained in:
parent
ae5e8eb0e4
commit
8ef0f079b6
1 changed files with 12 additions and 11 deletions
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue