@@ -506,10 +506,13 @@ impl<R: Runtime> WindowManager<R> {
506506 }
507507
508508 pub ( crate ) fn protocol_url ( & self ) -> Cow < ' _ , Url > {
509- #[ cfg( any( windows, target_os = "android" ) ) ]
510- return Cow :: Owned ( Url :: parse ( "https://tauri.localhost" ) . unwrap ( ) ) ;
511- #[ cfg( not( any( windows, target_os = "android" ) ) ) ]
512- Cow :: Owned ( Url :: parse ( "tauri://localhost" ) . unwrap ( ) )
509+ if cfg ! ( windows) {
510+ Cow :: Owned ( Url :: parse ( "http://tauri.localhost" ) . unwrap ( ) )
511+ } else if cfg ! ( target_os = "android" ) {
512+ Cow :: Owned ( Url :: parse ( "https://tauri.localhost" ) . unwrap ( ) )
513+ } else {
514+ Cow :: Owned ( Url :: parse ( "tauri://localhost" ) . unwrap ( ) )
515+ }
513516 }
514517
515518 fn csp ( & self ) -> Option < Csp > {
@@ -612,6 +615,11 @@ impl<R: Runtime> WindowManager<R> {
612615 let window_origin = if window_url. scheme ( ) == "data" {
613616 "null" . into ( )
614617 } else if cfg ! ( windows) && window_url. scheme ( ) != "http" && window_url. scheme ( ) != "https" {
618+ format ! ( "http://{}.localhost" , window_url. scheme( ) )
619+ } else if cfg ! ( target_os = "android" )
620+ && window_url. scheme ( ) != "http"
621+ && window_url. scheme ( ) != "https"
622+ {
615623 format ! ( "https://{}.localhost" , window_url. scheme( ) )
616624 } else {
617625 format ! (
@@ -876,6 +884,8 @@ mod test {
876884 assert_eq ! (
877885 manager. get_url( ) . to_string( ) ,
878886 if cfg!( windows) {
887+ "http://tauri.localhost/"
888+ } else if cfg!( target_os = "android" ) {
879889 "https://tauri.localhost/"
880890 } else {
881891 "tauri://localhost"
0 commit comments