Skip to content

How to set a custom Origin for Tauri App? #4912

Answered by FabianLars
skorotkiewicz asked this question in Q&A
Discussion options

You must be logged in to vote

For Windows something like this could work until we add native support for this

let win = app.get_window("main").unwrap();
win.with_webview(|webview| unsafe {
    let core = webview.controller().CoreWebView2().unwrap();
    let mut _token = EventRegistrationToken::default();
    // You'd probably use CONTEXT_WEBSOCKET or whatever fits, see https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2webresourcecontext?view=webview2-dotnet-1.0.1293.44
    // Also use a fitting glob filter, so that it doesn't trigger for all requests, see https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.1293.44#addwebresourcerequ…

Replies: 5 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@masterjanic
Comment options

Comment options

You must be logged in to vote
1 reply
@thewh1teagle
Comment options

Answer selected by skorotkiewicz
Comment options

You must be logged in to vote
2 replies
@me1ting
Comment options

@MirazMac
Comment options

Comment options

You must be logged in to vote
1 reply
@manyougz
Comment options

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants