tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
82.63k stars 2.48k forks source link

[bug] MacOS after updating to tauri version 1.2, the launch of the local page with parameters stopped working #5581

Open Bukmopbl4 opened 1 year ago

Bukmopbl4 commented 1 year ago

Describe the bug

new window.__TAURI__.window.WebviewWindow('test', {url: 'index.html?param=1'})

on version 1.2 this example stopped working. The desired page opens only without passing parameters.

Reproduction

No response

Expected behavior

No response

Platform and versions

Environment › OS: Mac OS 13.0.0 X64 › Node.js: 16.17.1 › npm: 8.15.0 › pnpm: Not installed! › yarn: Not installed! › rustup: 1.25.1 › rustc: 1.64.0 › cargo: 1.64.0 › Rust toolchain: stable-x86_64-apple-darwin

Packages WARNING: no lock files found, defaulting to npm › @tauri-apps/cli [NPM]: 1.2.0 › @tauri-apps/api [NPM]: Not installed! › tauri [RUST]: 1.2.0, › tauri-build [RUST]: 1.2.0, › tao [RUST]: 0.15.0, › wry [RUST]: 0.22.0,

App › build-type: bundle › CSP: unset › distDir: ../src › devPath: ../src package.json not found

App directory structure ├─ src-tauri ├─ .git ├─ .vscode └─ src

Stack trace

No response

Additional context

No response

FabianLars commented 1 year ago

Not sure if this is related to https://github.com/tauri-apps/tauri/issues/5582 but it seems to be macos only too 🤔 Or maybe i'm testing it wrong, i only check window.location.href in the new window and this still includes the query param.

FabianLars commented 1 year ago

ah wait, i didn't read the title carefully enough - can you explain your code a bit more (or show it) ? It seems to work fine for me on linux/win10

Bukmopbl4 commented 1 year ago

ah wait, i didn't read the title carefully enough - can you explain your code a bit more (or show it) ? It seems to work fine for me on linux/win10

win 10 works. Only macOS not working. The required html with parameters does not open at all.

lucasfernog commented 1 year ago

I tried this and it works fine on macOS 13. Can you give us more information? Is this on dev or on production? Do you see any errors in the console? What if you try to check for errors when creating the window:

const webview = new window.__TAURI__.window.WebviewWindow('test', {url: 'index.html?param=1'})
webview.once('tauri://error', function (e) {
  console.error('error creating webview', e)    
})
Bukmopbl4 commented 1 year ago

it works fine on macOS 13

it works fine for index.html, but a trying open second window with params like const webview = new window.__TAURI__.window.WebviewWindow('test', {url: 'monitorIdentify.html?monitor=1'}) for open new window en each monitor with number from url params and window was created but not showing my html and reload page with index.html content. In DEV - page reload In PROD - works!

Bukmopbl4 commented 1 year ago

Also, if links to resources with parameters were used, then such files are not loaded into the DEV too, but if you remove the parameters, then everything works right away. Ex: url(../fonts/font-awesome/fontawesome-webfont.woff?v=4.5.0)

lucasfernog commented 1 year ago

Ok that might be related to https://github.com/tauri-apps/wry/pull/706, we'll investigate further.

Bukmopbl4 commented 1 year ago

The problem hasn't been fixed yet.

pmgl commented 1 year ago

I think this may be related, I am on macOS too: static images won't load in the webview whenever the path includes a query parameter. Example from the webview devtools console in my Tauri app:

var img = new Image ;
img.src = "/sprites/background.png?v=42" ;

Image will not load ; if I remove the query parameter "?v=42", image will load successfully.