Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When h5 website is run, a white screen appears randomly and the program exits automatically #352

Open
zhuewizz opened this issue Apr 26, 2024 · 13 comments

Comments

@zhuewizz
Copy link

I've tried several times, on the same website, comparing webui-go with webview-go using a package generated by npm run buider: h5, and it looks like this:
webui-go: Click for a period of time, a white screen appears randomly, and the error is that js cannot be called dynamically
Automatic program exit
webview-go is absent
I don't quite understand why?
Calling from the website: https://tmui.design/h5
i test at window and ubuntu

@AlbertShown
Copy link
Contributor

Hey, did you add <script src="webui.js"></script> to your UI?

@zhuewizz
Copy link
Author

i not add <script src="webui.js"></script>,i will try aigan!!,thanks

@zhuewizz
Copy link
Author

I try add webui.js,still not fine
I use vue and npm run build
webui.show
web.w.ShowBrowser
i all try

@AlbertShown
Copy link
Contributor

To know what exactly causing this we need the webui's logs, please follow those instructions.

To get webui logs please follow this:

  1. Download the latest nightly build or stable release
  2. Copy debug version of webui dynamic library webui-xx-xx-xx/debug/webui.so (or .dll, .dynlib... depend on your OS)
  3. Past and replace your installed Go packages with this debug version :
    a. Can be in $GOPATH or $HOME/go
  4. Run your app again in the terminal, you will get webui's log as well
  5. Copy logs and share it here

@AlbertShown
Copy link
Contributor

Another thing, please share part of code where you use webui.
Also, I still don't see webui.js in https://tmui.design/h5, it's not updated yet?

@zhuewizz
Copy link
Author

zhuewizz commented Apr 26, 2024

https://tmui.design/h5,
It's using vue UI framework, I didn't develop it, I'm testing it locally, my code looks like this:
//ui.SetRootFolder("ui")
//w.Show("https://tmui.design/h5")
w.Show("https://vant-ui.github.io/vant/mobile.html#/zh-CN")
// Prepare the second window.
ui.Wait()
When I was developing locally, I added webui.js
The message appeared in the interface. When I did the route in the spa program, it would appear: Resource not available. I ran it directly in the browser, and there was no such phenomenon on every page
This situation is random, and the program exits

@AlbertShown
Copy link
Contributor

I see, as I said, it won't work if you can't add webui.js to the UI.
webui will run the window for you, and load the URL for you, but if your UI (HTML) does not include webui.js then there is no connection between your window and backend.

Solution is to add <script src="webui.js"></script> to https://tmui.design/h5.

@AlbertShown
Copy link
Contributor

If you still have any issue, please run it locally, add webui.js, then share the webui's logs here.

@zhuewizz
Copy link
Author

zhuewizz commented Apr 26, 2024

I'll get around to testing it,thks
https://tmui.design/h5.is Other people do demo sites, I can't change
I added it locally, but the right click in the application can't open it, I see in the browser: webui.js not found
What does webui.js do?

@AlbertShown
Copy link
Contributor

I will explain, webview embed the whole HTML/JS engine in your project, and it need WebView runtime libraries to be installed in your OS, but the result is you can for example get events from an external website, like https://tmui.design.

WebUI does it in another faster way, simply it run the installed web browser, and connect the web browser with your backend using WebSocket trough webui.js, you don't need any runtime... but, WebUI can not give you event of an external web site if you can not add webui.js.

@AlbertShown
Copy link
Contributor

@zhuewizz
Copy link
Author

i use python-webui show the same uri,not add webui.js ,but run and work fine!!
why use go-weiui is not fine ?

@AlbertShown
Copy link
Contributor

not add webui.js

Impossible!

work fine!!

Yes, python-webui will run the UI, but you won't receive any click events or anything without webui.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants