Skip to main content
← rust.krizaka.comkrizaka.com

Module nav_guard

Module nav_guard 

Source
Expand description

The navigation guard: a window stays on the app’s own pages (its local page, or the hosted web app it shows); a web link elsewhere opens in the person’s browser; anything else is refused.

Enums§

Navigation
What the window does with a navigation.
OriginError
Why an address cannot be a hosted app’s origin. None of them repeats the address: it may hold a credential.

Functions§

decide
Decides a navigation of a window whose own places are allowed (the local page, the hosted app’s origin).
normalize_origin
A hosted app must be HTTPS (plain http only for a loopback address), carry no credentials in its URL, and is reduced to its origin.
same_origin
True when target is on the same origin as allowed. A look-alike host (app.example.com.evil.example) is not.
same_place
The same place: scheme, host and port. Unlike same_origin, it also matches the app’s own local page (tauri://localhost), whose origin the URL standard calls opaque.