Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-inappbrowser

Package Overview
Dependencies
Maintainers
19
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-inappbrowser - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

23

package.json
{
"name": "cordova-plugin-inappbrowser",
"version": "4.0.0",
"version": "4.1.0",
"description": "Cordova InAppBrowser Plugin",

@@ -16,9 +16,4 @@ "types": "./types/index.d.ts",

},
"repository": {
"type": "git",
"url": "https://github.com/apache/cordova-plugin-inappbrowser"
},
"bugs": {
"url": "https://github.com/apache/cordova-plugin-inappbrowser/issues"
},
"repository": "github:apache/cordova-plugin-inappbrowser",
"bugs": "https://github.com/apache/cordova-plugin-inappbrowser/issues",
"keywords": [

@@ -38,4 +33,4 @@ "cordova",

"scripts": {
"test": "npm run eslint",
"eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint src && node node_modules/eslint/bin/eslint tests"
"test": "npm run lint",
"lint": "eslint ."
},

@@ -59,10 +54,4 @@ "engines": {

"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-semistandard": "^11.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-node": "^5.0.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1"
"@cordova/eslint-config": "^3.0.0"
}
}

@@ -71,2 +71,10 @@ ---

### Preferences
#### <b>config.xml</b>
- <b>InAppBrowserStatusBarStyle [iOS only]</b>: (string, options 'lightcontent' or 'default'. Defaults to 'default') set text color style for iOS.
```
<preference name="InAppBrowserStatusBarStyle" value="lightcontent" />
```
## cordova.InAppBrowser.open

@@ -172,2 +180,12 @@

### iOS Quirks
Since the introduction of iPadOS 13, iPads try to adapt their content mode / user agent for the optimal browsing experience. This may result in iPads having their user agent set to Macintosh, making it hard to detect them as mobile devices using user agent string sniffing. You can change this with the `PreferredContentMode` preference in `config.xml`.
```xml
<preference name="PreferredContentMode" value="mobile" />
```
The example above forces the user agent to contain `iPad`. The other option is to use the value `desktop` to turn the user agent to `Macintosh`.
### Browser Quirks

@@ -174,0 +192,0 @@

@@ -20,13 +20,7 @@ /*

*
*/
*/
var modulemapper = require('cordova/modulemapper');
var browserWrap,
popup,
navigationButtonsDiv,
navigationButtonsDivInner,
backButton,
forwardButton,
closeButton;
var browserWrap, popup, navigationButtonsDiv, navigationButtonsDivInner, backButton, forwardButton, closeButton;

@@ -36,6 +30,6 @@ function attachNavigationEvents (element, callback) {

try {
callback({ type: 'loaderror', url: this.contentWindow.location.href }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loaderror', url: this.contentWindow.location.href }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
} catch (err) {
// blocked by CORS :\
callback({ type: 'loaderror', url: null }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loaderror', url: null }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
}

@@ -46,6 +40,6 @@ };

try {
callback({ type: 'loadstart', url: this.contentWindow.location.href }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loadstart', url: this.contentWindow.location.href }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
} catch (err) {
// blocked by CORS :\
callback({ type: 'loadstart', url: null }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loadstart', url: null }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
}

@@ -56,6 +50,6 @@ });

try {
callback({ type: 'loadstop', url: this.contentWindow.location.href }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loadstop', url: this.contentWindow.location.href }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
} catch (err) {
// blocked by CORS :\
callback({ type: 'loadstop', url: null }, {keepCallback: true}); // eslint-disable-line standard/no-callback-literal
callback({ type: 'loadstop', url: null }, { keepCallback: true }); // eslint-disable-line standard/no-callback-literal
}

@@ -160,3 +154,5 @@ });

backButton.addEventListener('click', function (e) {
if (popup.canGoBack) { popup.goBack(); }
if (popup.canGoBack) {
popup.goBack();
}
});

@@ -172,3 +168,5 @@

forwardButton.addEventListener('click', function (e) {
if (popup.canGoForward) { popup.goForward(); }
if (popup.canGoForward) {
popup.goForward();
}
});

@@ -175,0 +173,0 @@

@@ -20,7 +20,6 @@ /*

*
*/
*/
/* jslint sloppy:true */
/* global Windows:true, setImmediate */
/* eslint standard/no-callback-literal : 0 */
/* eslint-disable standard/no-callback-literal */
/* global Windows, setImmediate */

@@ -48,3 +47,3 @@ var cordova = require('cordova');

element.addEventListener('MSWebViewNavigationStarting', function (e) {
callback({ type: 'loadstart', url: e.uri }, {keepCallback: true});
callback({ type: 'loadstart', url: e.uri }, { keepCallback: true });
});

@@ -56,3 +55,11 @@

} else {
callback({ type: 'loaderror', url: e.uri, code: e.webErrorStatus, message: 'Navigation failed with error code ' + e.webErrorStatus }, { keepCallback: true });
callback(
{
type: 'loaderror',
url: e.uri,
code: e.webErrorStatus,
message: 'Navigation failed with error code ' + e.webErrorStatus
},
{ keepCallback: true }
);
}

@@ -64,3 +71,6 @@ });

// http://msdn.microsoft.com/en-us/library/windows/apps/dn609716.aspx
callback({ type: 'loaderror', url: e.uri, code: e.webErrorStatus, message: 'Navigation failed with error code ' + e.webErrorStatus }, { keepCallback: true });
callback(
{ type: 'loaderror', url: e.uri, code: e.webErrorStatus, message: 'Navigation failed with error code ' + e.webErrorStatus },
{ keepCallback: true }
);
});

@@ -85,11 +95,11 @@

var onError = function () {
callback({ type: 'loaderror', url: this.contentWindow.location }, {keepCallback: true});
callback({ type: 'loaderror', url: this.contentWindow.location }, { keepCallback: true });
};
element.addEventListener('unload', function () {
callback({ type: 'loadstart', url: this.contentWindow.location }, {keepCallback: true});
callback({ type: 'loadstart', url: this.contentWindow.location }, { keepCallback: true });
});
element.addEventListener('load', function () {
callback({ type: 'loadstop', url: this.contentWindow.location }, {keepCallback: true});
callback({ type: 'loadstop', url: this.contentWindow.location }, { keepCallback: true });
});

@@ -183,3 +193,4 @@

popup = document.createElement(isWebViewAvailable ? 'x-ms-webview' : 'iframe');
if (popup instanceof HTMLIFrameElement) { // eslint-disable-line no-undef
if (popup instanceof HTMLIFrameElement) {
// eslint-disable-line no-undef
// For iframe we need to override bacground color of parent element here

@@ -249,3 +260,5 @@ // otherwise pages without background color set will have transparent background

backButton.addEventListener('click', function (e) {
if (popup.canGoBack) { popup.goBack(); }
if (popup.canGoBack) {
popup.goBack();
}
});

@@ -257,3 +270,5 @@

forwardButton.addEventListener('click', function (e) {
if (popup.canGoForward) { popup.goForward(); }
if (popup.canGoForward) {
popup.goForward();
}
});

@@ -303,7 +318,7 @@

// return null if event target is unavailable by some reason
var result = (e && e.target) ? [e.target.result] : [null];
var result = e && e.target ? [e.target.result] : [null];
win(result);
}
};
op.onerror = function () { };
op.onerror = function () {};
op.start();

@@ -335,3 +350,3 @@ }

};
op.onerror = function () { };
op.onerror = function () {};
op.start();

@@ -365,9 +380,14 @@ });

var uri = new Windows.Foundation.Uri(filePath.replace('ms-appx-web:', 'ms-appx:'));
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(function (file) {
return Windows.Storage.FileIO.readTextAsync(file);
}).done(function (code) {
injectCSS(popup, code, hasCallback && win);
}, function () {
// no-op, just catch an error
});
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri)
.then(function (file) {
return Windows.Storage.FileIO.readTextAsync(file);
})
.done(
function (code) {
injectCSS(popup, code, hasCallback && win);
},
function () {
// no-op, just catch an error
}
);
}

@@ -381,4 +401,6 @@ });

var escapedCode = JSON.stringify(cssCode);
var evalWrapper = '(function(d){var c=d.createElement(\'style\');c.innerHTML=%s;d.head.appendChild(c);})(document)'
.replace('%s', escapedCode);
var evalWrapper = "(function(d){var c=d.createElement('style');c.innerHTML=%s;d.head.appendChild(c);})(document)".replace(
'%s',
escapedCode
);

@@ -391,3 +413,3 @@ var op = webView.invokeScriptAsync('eval', evalWrapper);

};
op.onerror = function () { };
op.onerror = function () {};
op.start();

@@ -394,0 +416,0 @@ }

@@ -11,3 +11,8 @@ // Type definitions for Apache Cordova InAppBrowser plugin

interface Window {
/**
* The object returned from a call to cordova.InAppBrowser.open.
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser {
/**

@@ -22,9 +27,3 @@ * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.

open(url: string, target?: string, options?: string): InAppBrowser;
}
/**
* The object returned from a call to window.open.
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser extends Window {
onloadstart(type: Event): void;

@@ -31,0 +30,0 @@ onloadstop(type: InAppBrowserEvent): void;

@@ -20,3 +20,3 @@ /*

*
*/
*/

@@ -31,9 +31,9 @@ (function () {

this.channels = {
'beforeload': channel.create('beforeload'),
'loadstart': channel.create('loadstart'),
'loadstop': channel.create('loadstop'),
'loaderror': channel.create('loaderror'),
'exit': channel.create('exit'),
'customscheme': channel.create('customscheme'),
'message': channel.create('message')
beforeload: channel.create('beforeload'),
loadstart: channel.create('loadstart'),
loadstop: channel.create('loadstop'),
loaderror: channel.create('loaderror'),
exit: channel.create('exit'),
customscheme: channel.create('customscheme'),
message: channel.create('message')
};

@@ -44,3 +44,3 @@ }

_eventHandler: function (event) {
if (event && (event.type in this.channels)) {
if (event && event.type in this.channels) {
if (event.type === 'beforeload') {

@@ -47,0 +47,0 @@ this.channels[event.type].fire(event, this._loadAfterBeforeload);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc