You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HTML pages loaded into rpatchur's WebView will of course need to at some point use Javascript in button click handlers or whatever else to perform actions, and that means calling external.invoke() as per your own examples (e.g. /examples/basic_launcher/index.html found in this repository).
I believe this WebView integration is broken on non-Windows OS's.
On my Gentoo Linux PC, I was having issues running an rpatchur installation with no visible error. Debugging it via CLion, I saw this error pop up:
With the most important bit being obviously the Can't find variable: external bit which it encountered when running this line found in the mentioned index.html
external.invoke('start_update');
I was able to fix this by replacing all calls to external.invoke() with window.webkit.messageHandlers.external.postMessage() instead. This obviously will not work when the WebView is being backed by IE on Windows, so a suitable cross-platform solution would be nice here!
The text was updated successfully, but these errors were encountered:
To anyone else noticing this issue on a RO server using rpatchur, the suggestion found in the above linked issue on the web-view project to use this Javascript function to work around the cross-platform differences would seem to be the best bet.
// include this function somewhere in the page source you load into rpatchurfunctionsendMessageToServer(cmd){if(window.external!==undefined){returnwindow.external.invoke(cmd);}elseif(window.webkit.messageHandlers.external!==undefined){returnwindow.webkit.messageHandlers.external.postMessage(cmd);}thrownewError('Failed to locate webkit external handler')}
The HTML pages loaded into rpatchur's WebView will of course need to at some point use Javascript in button click handlers or whatever else to perform actions, and that means calling
external.invoke()
as per your own examples (e.g./examples/basic_launcher/index.html
found in this repository).I believe this WebView integration is broken on non-Windows OS's.
On my Gentoo Linux PC, I was having issues running an rpatchur installation with no visible error. Debugging it via CLion, I saw this error pop up:
With the most important bit being obviously the
Can't find variable: external
bit which it encountered when running this line found in the mentioned index.htmlI was able to fix this by replacing all calls to
external.invoke()
withwindow.webkit.messageHandlers.external.postMessage()
instead. This obviously will not work when the WebView is being backed by IE on Windows, so a suitable cross-platform solution would be nice here!The text was updated successfully, but these errors were encountered: