Skip to content

Commit 074d4d0

Browse files
authored
(all platforms): remove "window.open" overwrite (apache#600)
Closes apache#599
1 parent 548f19c commit 074d4d0

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ InAppBrowser window, by replacing window.open:
4343

4444
window.open = cordova.InAppBrowser.open;
4545

46+
If you change the browsers `window.open` function this way, it can have unintended side
47+
effects (especially if this plugin is included only as a dependency of another
48+
plugin).
49+
4650
The InAppBrowser window behaves like a standard web browser,
4751
and can't access Cordova APIs. For this reason, the InAppBrowser is recommended
4852
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.
5256
The InAppBrowser provides by default its own GUI controls for the user (back,
5357
forward, done).
5458

55-
For backwards compatibility, this plugin also hooks `window.open`.
56-
However, the plugin-installed hook of `window.open` can have unintended side
57-
effects (especially if this plugin is included only as a dependency of another
58-
plugin). The hook of `window.open` will be removed in a future major release.
59-
Until the hook is removed from the plugin, apps can manually restore the default
60-
behaviour:
61-
62-
delete window.open // Reverts the call back to its prototype's default
63-
64-
Although `window.open` is in the global scope, InAppBrowser is not available until after the `deviceready` event.
65-
66-
document.addEventListener("deviceready", onDeviceReady, false);
67-
function onDeviceReady() {
68-
console.log("window.open works well");
69-
}
70-
7159
## Installation
7260

7361
cordova plugin add cordova-plugin-inappbrowser

plugin.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<platform name="android">
3838
<js-module src="www/inappbrowser.js" name="inappbrowser">
3939
<clobbers target="cordova.InAppBrowser.open" />
40-
<clobbers target="window.open" />
4140
</js-module>
4241
<config-file target="res/xml/config.xml" parent="/*">
4342
<feature name="InAppBrowser">
@@ -71,7 +70,6 @@
7170
<platform name="ios">
7271
<js-module src="www/inappbrowser.js" name="inappbrowser">
7372
<clobbers target="cordova.InAppBrowser.open" />
74-
<clobbers target="window.open" />
7573
</js-module>
7674
<config-file target="config.xml" parent="/*">
7775
<feature name="InAppBrowser">
@@ -95,7 +93,6 @@
9593
<platform name="osx">
9694
<js-module src="www/inappbrowser.js" name="inappbrowser">
9795
<clobbers target="cordova.InAppBrowser.open" />
98-
<clobbers target="window.open" />
9996
</js-module>
10097
<config-file target="config.xml" parent="/*">
10198
<feature name="InAppBrowser">
@@ -111,7 +108,6 @@
111108
<platform name="windows">
112109
<js-module src="www/inappbrowser.js" name="inappbrowser">
113110
<clobbers target="cordova.InAppBrowser.open" />
114-
<clobbers target="window.open" />
115111
</js-module>
116112
<js-module src="src/windows/InAppBrowserProxy.js" name="InAppBrowserProxy">
117113
<runs />
@@ -123,7 +119,6 @@
123119
<platform name="browser">
124120
<js-module src="www/inappbrowser.js" name="inappbrowser">
125121
<clobbers target="cordova.InAppBrowser.open" />
126-
<clobbers target="window.open" />
127122
</js-module>
128123
<js-module src="src/browser/InAppBrowserProxy.js" name="InAppBrowserProxy">
129124
<runs />

0 commit comments

Comments
 (0)