native: open links in default webbrowser (#4623)

This commit is contained in:
Nico Burns authored and GitHub committed 2025-10-03 13:43:47 -07:00
1 parent 6cfe64209a
commit ab19ad4624
6 files changed
+30 -2

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
use blitz_traits::{
navigation::{NavigationOptions, NavigationProvider},
net::Method,
};
pub(crate) struct DioxusNativeNavigationProvider;
impl NavigationProvider for DioxusNativeNavigationProvider {
fn navigate_to(&self, options: NavigationOptions) {
if options.method == Method::GET
&& matches!(options.url.scheme(), "http" | "https" | "mailto")
{
if let Err(err) = webbrowser::open(options.url.as_str()) {
tracing::error!("Failed to open URL: {}", err);
}
}
}
}