From e5862bf820b98bfebe8dfa737b6f6c89e3972172 Mon Sep 17 00:00:00 2001 From: Yangtb Date: Wed, 11 Sep 2013 16:18:47 +0800 Subject: [PATCH] [CB-4724] fixed UriFormatException fixed UriFormatException & InvalidOperationException --- src/wp/InAppBrowser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs index 46e1384..007fd34 100644 --- a/src/wp/InAppBrowser.cs +++ b/src/wp/InAppBrowser.cs @@ -96,7 +96,7 @@ namespace WPCordovaClassLib.Cordova.Commands private void ShowInAppBrowser(string url) { - Uri loc = new Uri(url); + Uri loc = new Uri(url, UriKind.RelativeOrAbsolute); Deployment.Current.Dispatcher.BeginInvoke(() => { @@ -251,7 +251,7 @@ namespace WPCordovaClassLib.Cordova.Commands } #endif - string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; this.DispatchCommandResult(result); @@ -259,7 +259,7 @@ namespace WPCordovaClassLib.Cordova.Commands void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) { - string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.ERROR, message); result.KeepCallback = true; this.DispatchCommandResult(result); @@ -267,7 +267,7 @@ namespace WPCordovaClassLib.Cordova.Commands void browser_Navigating(object sender, NavigatingEventArgs e) { - string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.AbsoluteUri + "\"}"; + string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; this.DispatchCommandResult(result);