question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No `external` in Ubuntu 20.04 applications

See original GitHub issue

I’ve cloned this repo, navigated into webview-examples and run cargo 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: image

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.

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

Is there any way to fix it or at least do debug it further?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
SomeoneToIgnorecommented, Jul 13, 2021

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')
}
0reactions
Randall-Codingcommented, Jul 14, 2021

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

accessing external hdd from application - Ask Ubuntu
I have been given a pc that runs ubuntu 20.04. with this pc I need to work on files stored on an external...
Read more >
Installing Linux (Ubuntu 20.04) on an external portable SSD ...
The great thing about installing an Ubuntu OS on an external SSD drive is that, you can easily use and switch between both...
Read more >
Open applications for devices or discs
If you do not want any applications to be opened automatically, whatever you plug in, select Never prompt or start programs on media...
Read more >
SoundTroubleshootingProcedure - Community Help Wiki
You may want to follow this guide to gather essential troubleshooting information about your sound card. This information will be useful in ...
Read more >
Install additional applications - Official Ubuntu Documentation
In such a case in Ubuntu Software the snap will be listed first. You may also wish to install software that does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found