Browser improvements
This commit is contained in:
parent
31c8d4236a
commit
bc74ba361c
@ -257,6 +257,18 @@ function openCheckoutWindowToSaveCard() {
|
|||||||
openBrowser(SETTINGS.apis.redirecttopaymentsetup
|
openBrowser(SETTINGS.apis.redirecttopaymentsetup
|
||||||
+ "?phone=" + getStorage("phonenumber")
|
+ "?phone=" + getStorage("phonenumber")
|
||||||
+ "&accountkey=" + getStorage("accountkey"),
|
+ "&accountkey=" + getStorage("accountkey"),
|
||||||
"location=no"
|
"location=yes",
|
||||||
);
|
function () {
|
||||||
|
// on exit browser
|
||||||
|
initAccountPage();
|
||||||
|
},
|
||||||
|
function (params) {
|
||||||
|
// on get message from browser
|
||||||
|
// only message we should get is "kill me"
|
||||||
|
if (params.data.my_message == "kill me") {
|
||||||
|
initAccountPage();
|
||||||
|
closeBrowser();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
@ -18,10 +18,16 @@ var nw_tray = null;
|
|||||||
*/
|
*/
|
||||||
var auto_disable_animations = false;
|
var auto_disable_animations = false;
|
||||||
|
|
||||||
|
var cordovaInAppBrowserRef = null;
|
||||||
|
|
||||||
var openBrowser = function (url) {
|
var openBrowser = function (url) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var closeBrowser = function () {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
var openSystemBrowser = function (url) {
|
var openSystemBrowser = function (url) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
@ -172,11 +178,25 @@ function initCordova() {
|
|||||||
window.htmlopen = window.open;
|
window.htmlopen = window.open;
|
||||||
window.open = cordova.InAppBrowser.open;
|
window.open = cordova.InAppBrowser.open;
|
||||||
|
|
||||||
openBrowser = function (url, options) {
|
openBrowser = function (url, options, onclose, onmessage) {
|
||||||
if (typeof options == "undefined") {
|
if (typeof options == "undefined") {
|
||||||
options = "location=yes";
|
options = "location=yes";
|
||||||
}
|
}
|
||||||
window.open(url, '_blank', options);
|
cordovaInAppBrowserRef = cordova.InAppBrowser.open(url, "_blank", options);
|
||||||
|
if (typeof onclose == "function") {
|
||||||
|
cordovaInAppBrowserRef.removeEventListener("exit");
|
||||||
|
cordovaInAppBrowserRef.addEventListener("exit", onclose);
|
||||||
|
}
|
||||||
|
if (typeof onmessage == "function") {
|
||||||
|
cordovaInAppBrowserRef.removeEventListener("message");
|
||||||
|
cordovaInAppBrowserRef.addEventListener("message", onmessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closeBrowser = function () {
|
||||||
|
if (typeof cordovaInAppBrowserRef != null) {
|
||||||
|
cordovaInAppBrowserRef.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openExternalBrowser = function (url) {
|
openExternalBrowser = function (url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user