You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/04/22 02:59:00 UTC

[1/2] git commit: CB-6474 InAppBrowser. Add data urls support to WP8

Repository: cordova-plugin-inappbrowser
Updated Branches:
  refs/heads/dev 907bba6cf -> e2a0bb871


CB-6474 InAppBrowser. Add data urls support to WP8


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/8f2ad211
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/8f2ad211
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/8f2ad211

Branch: refs/heads/dev
Commit: 8f2ad211ad60a10d7234124ff3c815e6a3b70ff1
Parents: e282cc9
Author: sgrebnov <v-...@microsoft.com>
Authored: Fri Apr 18 10:47:20 2014 -0700
Committer: sgrebnov <v-...@microsoft.com>
Committed: Fri Apr 18 10:47:20 2014 -0700

----------------------------------------------------------------------
 src/wp/InAppBrowser.cs | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/8f2ad211/src/wp/InAppBrowser.cs
----------------------------------------------------------------------
diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs
index 454464d..844ae16 100644
--- a/src/wp/InAppBrowser.cs
+++ b/src/wp/InAppBrowser.cs
@@ -200,7 +200,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                         if (cView != null)
                         {
                             WebBrowser br = cView.Browser;
-                            br.Navigate(loc);
+                            br.Navigate2(loc);
                         }
                     }
 
@@ -225,7 +225,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                 if (browser != null)
                 {
                     //browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
-                    browser.Navigate(loc);
+                    browser.Navigate2(loc);
                 }
                 else
                 {
@@ -248,7 +248,7 @@ namespace WPCordovaClassLib.Cordova.Commands
                                 browser.Navigating += new EventHandler<NavigatingEventArgs>(browser_Navigating);
                                 browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed);
                                 browser.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(browser_Navigated);
-                                browser.Navigate(loc);
+                                browser.Navigate2(loc);
 
                                 if (StartHidden)
                                 {
@@ -405,4 +405,29 @@ namespace WPCordovaClassLib.Cordova.Commands
         }
 
     }
+
+    internal static class WebBrowserExtensions
+    {
+        /// <summary>
+        /// Improved method to initiate request to the provided URI. Supports 'data:text/html' urls. 
+        /// </summary>
+        /// <param name="browser">The browser instance</param>
+        /// <param name="uri">The requested uri</param>
+        internal static void Navigate2(this WebBrowser browser, Uri uri)
+        {
+            // IE10 does not support data uri so we use NavigateToString method instead
+            if (uri.Scheme == "data")
+            {
+                // we should remove the scheme identifier and unescape the uri
+                string uriString = Uri.UnescapeDataString(uri.AbsoluteUri);
+                // format is 'data:text/html, ...'
+                string html = new System.Text.RegularExpressions.Regex("^data:text/html,").Replace(uriString, "");
+                browser.NavigateToString(html);
+            }
+            else 
+            {
+                browser.Navigate(uri);
+            }
+        }
+    }
 }


[2/2] git commit: Merge branch 'CB-6474' of https://github.com/sgrebnov/cordova-plugin-inappbrowser into dev

Posted by pu...@apache.org.
Merge branch 'CB-6474' of https://github.com/sgrebnov/cordova-plugin-inappbrowser into dev


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/e2a0bb87
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/e2a0bb87
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/e2a0bb87

Branch: refs/heads/dev
Commit: e2a0bb8715b78ee1edaa91935aec21f004ced384
Parents: 907bba6 8f2ad21
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Apr 21 17:57:48 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Apr 21 17:57:48 2014 -0700

----------------------------------------------------------------------
 src/wp/InAppBrowser.cs | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/e2a0bb87/src/wp/InAppBrowser.cs
----------------------------------------------------------------------