Browser improvements
This commit is contained in:
		
							parent
							
								
									31c8d4236a
								
							
						
					
					
						commit
						bc74ba361c
					
				| @ -257,6 +257,18 @@ function openCheckoutWindowToSaveCard() { | ||||
|     openBrowser(SETTINGS.apis.redirecttopaymentsetup | ||||
|             + "?phone=" + getStorage("phonenumber") | ||||
|             + "&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 cordovaInAppBrowserRef = null; | ||||
| 
 | ||||
| var openBrowser = function (url) { | ||||
|     window.open(url); | ||||
| } | ||||
| 
 | ||||
| var closeBrowser = function () { | ||||
|     // stub
 | ||||
| } | ||||
| 
 | ||||
| var openSystemBrowser = function (url) { | ||||
|     window.open(url); | ||||
| } | ||||
| @ -172,11 +178,25 @@ function initCordova() { | ||||
|         window.htmlopen = window.open; | ||||
|         window.open = cordova.InAppBrowser.open; | ||||
| 
 | ||||
|         openBrowser = function (url, options) { | ||||
|         openBrowser = function (url, options, onclose, onmessage) { | ||||
|             if (typeof options == "undefined") { | ||||
|                 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) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user