I have an UIWebView, that used to login with External Library (Gigya). The JavaScript code looks like this:
window.onload = function () {
gigya.accounts.showScreenSet({
screenSet: 'Login-web',
mobileScreenSet: 'testMobile',
deviceType: 'auto'
});
}
**function DisplayEventMessage(eventObj) {
alert(eventObj.eventName + " event happened");
window.location="callmycode:cmd=showAlert&var=myVar";
}
gigya.socialize.addEventHandlers({
onLogin:DisplayEventMessage,
onConnectionAdded:DisplayEventMessage,
onConnectionRemoved:DisplayEventMessage
}
);**
The code asks Gigya SDK to add this page to his delegate; (gigya.socialize.addEventHandlers
). but when someone logins with Facebook, its opens new tab on normal browser (about:blank
) but in the UIWebView
, Its just loading the new site, not a tab. so, the javascript code disabling, because the page is not exists anymore.
how can I still enable this code even the page not exists?
(Just posting the answer if someone will need this help:)
The answer is quite simple, just redirect to the Safari browser.
I can't get it to work with UIWebView
.
Example code:
(Opening safari:)
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
(**here the link opening:**)
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
return YES;
}
(Some code in the site handling the redirect to the application)
(JavaScript)
window.location = "yourapp://<some information needed>";
I did it in another way, I recognised the link opening, and started native window from Gigya's SDK to login.