Hello,
Here is the latest code I am using as I found the newer version of PG doesn't support "window.plugins". I am getting a blank screen somewhere/sometime around the window.open. I have also a window.location.hash = ''" in some generic js.
versions:
v2.0 (originally 1.2)
PG: 3.3.0
jq mobile: 1.4.0
jq 1.9.1
var redirectUrl = encodeURIComponent(pathname);
var url = 'https://www.facebook.com/dialog/oauth...;
url += '&redirect_uri=' + redirectUrl;
url += '&state='+OAuth.nonce(17);
var deviceType = (navigator.userAgent.match(/iPad/i)) == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : (navigator.userAgent.match(/BlackBerry/i)) == "BlackBerry" ? "BlackBerry" : "desktop";
//localStorage.setItem('deviceType', deviceType);
if (deviceType != 'desktop') {
//alert(url);
var ref = window.open(url, '_blank', 'location=no');
BLANK SCREEN
ref.addEventListener('loadstart', function(event) {
if(event.url.indexOf(redirectUrl) === 0) {
/* if user successfully logged in */
ref.close();
var vars = parseUrlVars(event.url);
localStorage.setItem('code', vars.code);
Appery.navigateTo('startScreen', {reverse: false});
}
});
} else {
localStorage.setItem('code', '');
window.open(url);
// works fine from in non-native mode
}