on 04-20-2015 5:50 PM
Hi Experts,
Our mobile APP team is trying to load the website screens on the webview of the native app(specifically the cart & payment page). we are finding difficulties to handle the session from the native to webview. please suggest if anyone has solution.
Thanks and Regards, Subbu.
Hi Subbu & Gernot,
This question has come up in the past and I'm not sure if anyone has solved it successfully. The problem is that the storefront manages the session differently than does OCC. One option might be to pass the token from the web view using javascript, but we've never actually tried it ourselves to see if this works well.
I've seen an answer on stackoverflow that might be of use: http://stackoverflow.com/questions/30108265/use-facebook-ios-sdk-auth-token-in-webview
Posted on Stackoverflow
I am assuming that your question is simply how to pass data from native app to a webview. You can use js. e.g. Suppose this is the code on your webview which uses the access token saved as test.html:
<html>
<head></head>
<body>
<script type="text/javascript">
function usesAccessToken(access_token_string) {
// use access token
alert(access_token_string);
}
</script>
</body>
</html>
You can pass values to the js function in the following manner:
[self.myAppWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"]isDirectory:NO]]];
In the UIWebViewDelegate delegate method:
(void)webViewDidFinishLoad:(UIWebView *)webView { NSString *accessToken = [FBSDKAccessToken currentAccessToken].tokenString; NSString *functionToCall = [NSString stringWithFormat:@"usesAccessToken('%@')", accessToken]; [self.myAppWebView stringByEvaluatingJavaScriptFromString:functionToCall]; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
have there ever been response on that. I'm highly interested, too!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.