'Greet' example does not work on Windows 11 or Linux (Pop_OS 22.04)
The 'greet' example from this repo gives the following error in the devtools console on Windows:
Fetch API cannot load ipc://localhost/greet/greet. URL scheme "ipc" is not supported.
On Linux, the following error is received instead:
[Error] Origin http://localhost:1420 is not allowed by Access-Control-Allow-Origin. Status code: 200
[Error] Failed to load resource: Origin http://localhost:1420 is not allowed by Access-Control-Allow-Origin. Status code: 200 (greet, line 0)
[Error] Fetch API cannot load ipc://localhost/greet/greet due to access control checks.
The example does appear to work just fine on MacOS.
Steps to reproduce:
- Clone a fresh copy of the tauri-bindgen repository to the test machine
- Checkout the 'v.0.2.0' tag
- Change directory into the 'examples/greet' folder and run 'cargo tauri dev'
- Open the console in devtools, enter a name into the main window text box, then hit the 'Greet' button
Expected result:
Text to appear below the text box with a greeting using the name provided.
Actual result:
Nothing appears in the main window and errors appear in the devtools console. tauri-bindgen-error_windows.txt tauri-bindgen-error_linux.txt
Thanks for the report, I kinda expected this to be the case since I haven't tried the new ipc router on windows or linux yet. Thanks for the heads up though 👍
Edit: For later reference the url scheme on windows looks like this https://${protocol}.localhost/${path}
Edit2: Fixing this on linux is more difficult since older versions of webkitgtk don't preserve request bodies (please don't ask why, I don't know myself it's absolutely stupid) with this only being fixed in the very latest versions. We're currently exploring all possible options (including potentially replacing webkitgtk with chromium) so any ideas are very welcome here
I could try to provide a PR for this (to fix this on Windows).
I would use conditional compilation or any other suggestions. (Command line flag?) At the moment the CI is running on Linux. Suggestion would be for the moment to just add an extra condition for windows.
Would that be ok?
Edit1:
- Generation for Windows and Mac via CLI should be straight forward
- Open Question: How to deal with WebAssembly (WASM) to set the correct OS?
- add a
build.rsto guest-rust?
- add a
any updates? my current suggestion would be to add a flag and if not present fall back to the current os as the default, I think I could provide a PR draft if I know what the way to go should be.