mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
docs: update WebViewBuilder::with_asynchronous_custom_protocol with platform-specific notes (#12830)
This commit is contained in:
@@ -1727,6 +1727,17 @@ tauri::Builder::default()
|
||||
/// }
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
/// Pages loaded from custom protocol will have different Origin on different platforms. And
|
||||
/// servers which enforce CORS will need to add exact same Origin header in `Access-Control-Allow-Origin`
|
||||
/// if you wish to send requests with native `fetch` and `XmlHttpRequest` APIs. Here are the
|
||||
/// different Origin headers across platforms:
|
||||
///
|
||||
/// - macOS, iOS and Linux: `<scheme_name>://<path>` (so it will be `my-scheme://path/to/page).
|
||||
/// - Windows and Android: `http://<scheme_name>.<path>` by default (so it will be `http://my-scheme.path/to/page`).
|
||||
/// To use `https` instead of `http`, use [`super::webview::WebviewBuilder::use_https_scheme`].
|
||||
#[must_use]
|
||||
pub fn register_uri_scheme_protocol<
|
||||
N: Into<String>,
|
||||
@@ -1784,6 +1795,17 @@ tauri::Builder::default()
|
||||
/// });
|
||||
/// });
|
||||
/// ```
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
/// Pages loaded from custom protocol will have different Origin on different platforms. And
|
||||
/// servers which enforce CORS will need to add exact same Origin header in `Access-Control-Allow-Origin`
|
||||
/// if you wish to send requests with native `fetch` and `XmlHttpRequest` APIs. Here are the
|
||||
/// different Origin headers across platforms:
|
||||
///
|
||||
/// - macOS, iOS and Linux: `<scheme_name>://<path>` (so it will be `my-scheme://path/to/page).
|
||||
/// - Windows and Android: `http://<scheme_name>.<path>` by default (so it will be `http://my-scheme.path/to/page`).
|
||||
/// To use `https` instead of `http`, use [`super::webview::WebviewBuilder::use_https_scheme`].
|
||||
#[must_use]
|
||||
pub fn register_asynchronous_uri_scheme_protocol<
|
||||
N: Into<String>,
|
||||
|
||||
@@ -554,6 +554,16 @@ impl<R: Runtime, C: DeserializeOwned> Builder<R, C> {
|
||||
/// .build()
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
/// Pages loaded from custom protocol will have different Origin on different platforms. And
|
||||
/// servers which enforce CORS will need to add exact same Origin header in `Access-Control-Allow-Origin`
|
||||
/// if you wish to send requests with native `fetch` and `XmlHttpRequest` APIs. Here are the
|
||||
/// different Origin headers across platforms:
|
||||
///
|
||||
/// - macOS, iOS and Linux: `<scheme_name>://<path>` (so it will be `my-scheme://path/to/page).
|
||||
/// - Windows and Android: `http://<scheme_name>.<path>` by default (so it will be `http://my-scheme.path/to/page`).
|
||||
#[must_use]
|
||||
pub fn register_uri_scheme_protocol<
|
||||
N: Into<String>,
|
||||
@@ -617,6 +627,16 @@ impl<R: Runtime, C: DeserializeOwned> Builder<R, C> {
|
||||
/// .build()
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
/// Pages loaded from custom protocol will have different Origin on different platforms. And
|
||||
/// servers which enforce CORS will need to add exact same Origin header in `Access-Control-Allow-Origin`
|
||||
/// if you wish to send requests with native `fetch` and `XmlHttpRequest` APIs. Here are the
|
||||
/// different Origin headers across platforms:
|
||||
///
|
||||
/// - macOS, iOS and Linux: `<scheme_name>://<path>` (so it will be `my-scheme://path/to/page).
|
||||
/// - Windows and Android: `http://<scheme_name>.<path>` by default (so it will be `http://my-scheme.path/to/page`).
|
||||
#[must_use]
|
||||
pub fn register_asynchronous_uri_scheme_protocol<
|
||||
N: Into<String>,
|
||||
|
||||
Reference in New Issue
Block a user