Sometimes we have do some process in server side web page via the browser in Mobile App.
But, how do we handle the callback when we finish the process in server side?
Server Page Callback Mechanism in Android
•How to retrieve the data which user finish the process in Server Page by using WebView in Android App?
–Extracting HTML from a WebView
http:///lexandera.com/2009/01/extracting-html-from-a-webview
•Using addJavascriptInterface
–Security issue in data transfer.
•SSL
•Use Token
–App stored the encrypted Token(including identity info)
•Encrypted Data Directly
–Encrypt callback data(confidential data) by AES.
•Step 1. Create an Account Handler
•Step 2. Register Handler as a JavaScript Interface
by using addJavascriptInterface.
•Step 3. Invoke Handler
Server Page (asp.net)
Server Page Callback Mechanism in iOS
1. Extract HTML DOM
–Server Page response the data with specific tag
•<Account>[email protected]</Account>
–Client App extracting DOM value by using stringByEvaluatingJavaScriptFromString.
•2. Intercept JavaScript window.open event.
–We can define a specific URI schema, such as “testcallback” and listen in shouldStartLoadWithRequest event.
–And define the Host name or Parameters of URI to assign different functions.
沒有留言:
張貼留言