Open SomeoneToIgnore opened 3 years ago
Looks like it's available in window.webkit.messageHandlers.external.postMessage
on this platform, so can be workarounded.
But still weird to not to see it available as window.external
there too.
This must be the same issue I'm running into https://github.com/Boscop/web-view/issues/296
I wonder if you can help me understand what the implication of this is. Does this mean the Ubuntu 20.04 version of the app should be coded differently? Or is there a way to check and use window.external
only when it is available?
the same issue
Indeed looks like the same issue. What if we close a less detailed one as a duplicate?
Does this mean the Ubuntu 20.04 version of the app should be coded differently?
A bit, yes. I've used this function as a workaround and it worked fine for me on both macOs and Ubuntu:
function sendMessageToServer(cmd) {
if (window.external !== undefined) {
return window.external.invoke(cmd);
} else if (window.webkit.messageHandlers.external !== undefined) {
return window.webkit.messageHandlers.external.postMessage(cmd);
}
throw new Error('Failed to locate webkit external handler')
}
the same issue
Indeed looks like the same issue. What if we close a less detailed one as a duplicate?
Does this mean the Ubuntu 20.04 version of the app should be coded differently?
A bit, yes. I've used this function as a workaround and it worked fine for me on both macOs and Ubuntu:
function sendMessageToServer(cmd) { if (window.external !== undefined) { return window.external.invoke(cmd); } else if (window.webkit.messageHandlers.external !== undefined) { return window.webkit.messageHandlers.external.postMessage(cmd); } throw new Error('Failed to locate webkit external handler') }
Sure thing. Thanks a lot!
I've cloned this repo, navigated into
webview-examples
and runcargo run --example todo
.Expected: TODO app runs and works Actual: app starts, but no UI elements are displayed in the app
Seems like there's no
external
(window.external
) object in the page:On the other hand,
minimal
example works just fine, displaying a Wiki page. Also both examples work on macOS and Windows for me.I'm using stock Ubuntu with a few packages installed to successfully compile the examples.
Is there any way to fix it or at least do debug it further?