You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2020/04/14 13:26:08 UTC

[cordova-plugin-inappbrowser] branch master updated: (all platforms): remove "window.open" overwrite (#600)

This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git


The following commit(s) were added to refs/heads/master by this push:
     new 074d4d0  (all platforms): remove "window.open" overwrite (#600)
074d4d0 is described below

commit 074d4d03eaccb9210f21f600aed837b2049016d8
Author: Niklas Merz <ni...@apache.org>
AuthorDate: Tue Apr 14 15:25:54 2020 +0200

    (all platforms): remove "window.open" overwrite (#600)
    
    Closes #599
---
 README.md  | 20 ++++----------------
 plugin.xml |  5 -----
 2 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/README.md b/README.md
index 72de923..4df9607 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,10 @@ InAppBrowser window, by replacing window.open:
 
     window.open = cordova.InAppBrowser.open;
 
+If you change the browsers `window.open` function this way, it can have unintended side
+effects (especially if this plugin is included only as a dependency of another
+plugin).
+
 The InAppBrowser window behaves like a standard web browser,
 and can't access Cordova APIs. For this reason, the InAppBrowser is recommended
 if you need to load third-party (untrusted) content, instead of loading that
@@ -52,22 +56,6 @@ whitelist, nor is opening links in the system browser.
 The InAppBrowser provides by default its own GUI controls for the user (back,
 forward, done).
 
-For backwards compatibility, this plugin also hooks `window.open`.
-However, the plugin-installed hook of `window.open` can have unintended side
-effects (especially if this plugin is included only as a dependency of another
-plugin).  The hook of `window.open` will be removed in a future major release.
-Until the hook is removed from the plugin, apps can manually restore the default
-behaviour:
-
-    delete window.open // Reverts the call back to its prototype's default
-
-Although `window.open` is in the global scope, InAppBrowser is not available until after the `deviceready` event.
-
-    document.addEventListener("deviceready", onDeviceReady, false);
-    function onDeviceReady() {
-        console.log("window.open works well");
-    }
-
 ## Installation
 
     cordova plugin add cordova-plugin-inappbrowser
diff --git a/plugin.xml b/plugin.xml
index 8cf6068..6a89657 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -37,7 +37,6 @@
     <platform name="android">
         <js-module src="www/inappbrowser.js" name="inappbrowser">
             <clobbers target="cordova.InAppBrowser.open" />
-            <clobbers target="window.open" />
         </js-module>
         <config-file target="res/xml/config.xml" parent="/*">
             <feature name="InAppBrowser">
@@ -71,7 +70,6 @@
     <platform name="ios">
         <js-module src="www/inappbrowser.js" name="inappbrowser">
             <clobbers target="cordova.InAppBrowser.open" />
-            <clobbers target="window.open" />
         </js-module>
         <config-file target="config.xml" parent="/*">
             <feature name="InAppBrowser">
@@ -95,7 +93,6 @@
     <platform name="osx">
         <js-module src="www/inappbrowser.js" name="inappbrowser">
             <clobbers target="cordova.InAppBrowser.open" />
-            <clobbers target="window.open" />
         </js-module>
         <config-file target="config.xml" parent="/*">
             <feature name="InAppBrowser">
@@ -111,7 +108,6 @@
     <platform name="windows">
         <js-module src="www/inappbrowser.js" name="inappbrowser">
             <clobbers target="cordova.InAppBrowser.open" />
-            <clobbers target="window.open" />
         </js-module>
         <js-module src="src/windows/InAppBrowserProxy.js" name="InAppBrowserProxy">
             <runs />
@@ -123,7 +119,6 @@
     <platform name="browser">
         <js-module src="www/inappbrowser.js" name="inappbrowser">
             <clobbers target="cordova.InAppBrowser.open" />
-            <clobbers target="window.open" />
         </js-module>
         <js-module src="src/browser/InAppBrowserProxy.js" name="InAppBrowserProxy">
             <runs />


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org