CB-4858 Convert relative URLs to absolute URLs in JS
This commit is contained in:
parent
8df4b7d03b
commit
8a6bc01814
@ -8,6 +8,9 @@
|
|||||||
<license>Apache 2.0</license>
|
<license>Apache 2.0</license>
|
||||||
<keywords>cordova,in,app,browser,inappbrowser</keywords>
|
<keywords>cordova,in,app,browser,inappbrowser</keywords>
|
||||||
|
|
||||||
|
<engines>
|
||||||
|
<engine name="cordova" version=">=3.1.0" /><!-- Needs cordova/urlutil -->
|
||||||
|
</engines>
|
||||||
|
|
||||||
<js-module src="www/InAppBrowser.js" name="InAppBrowser">
|
<js-module src="www/InAppBrowser.js" name="InAppBrowser">
|
||||||
<clobbers target="window.open" />
|
<clobbers target="window.open" />
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
var exec = require('cordova/exec');
|
var exec = require('cordova/exec');
|
||||||
var channel = require('cordova/channel');
|
var channel = require('cordova/channel');
|
||||||
var modulemapper = require('cordova/modulemapper');
|
var modulemapper = require('cordova/modulemapper');
|
||||||
|
var urlutil = require('cordova/urlutil');
|
||||||
|
|
||||||
function InAppBrowser() {
|
function InAppBrowser() {
|
||||||
this.channels = {
|
this.channels = {
|
||||||
@ -81,17 +82,18 @@ InAppBrowser.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports = function(strUrl, strWindowName, strWindowFeatures) {
|
module.exports = function(strUrl, strWindowName, strWindowFeatures) {
|
||||||
var iab = new InAppBrowser();
|
|
||||||
var cb = function(eventname) {
|
|
||||||
iab._eventHandler(eventname);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Don't catch calls that write to existing frames (e.g. named iframes).
|
// Don't catch calls that write to existing frames (e.g. named iframes).
|
||||||
if (window.frames && window.frames[strWindowName]) {
|
if (window.frames && window.frames[strWindowName]) {
|
||||||
var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
|
var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
|
||||||
return origOpenFunc.apply(window, arguments);
|
return origOpenFunc.apply(window, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strUrl = urlutil.makeAbsolute(strUrl);
|
||||||
|
var iab = new InAppBrowser();
|
||||||
|
var cb = function(eventname) {
|
||||||
|
iab._eventHandler(eventname);
|
||||||
|
};
|
||||||
|
|
||||||
exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
|
exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
|
||||||
return iab;
|
return iab;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user