I have this following code in chrome extension which when the window.top.location.href be https://www.facebook.com/connect/login_success.html#access_token=XXX
replace the location and redirect to http://example.com/login.php?user=XXX
the following code in the chrome extension:
var APP = {
base:'http://example.com/login.php?user=',
count:function (array) {
var keys = [], k;
for (k in array) {
if (Object.prototype.hasOwnProperty.call(array, k)) {
keys.push(k);
}
}
return keys;
}
};
$(document).ready(function () {
var URL = window.top.location.href;
if (URL.match(/https:\/\/www\.facebook\.com\/dialog\/oauth\?scope=email&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success\.html&response_type=token&client_id=/i)) {
}
if (URL.match(/https:\/\/www\.facebook\.com\/connect\/login_success\.html/i)) {
chrome.runtime.sendMessage({greeting:"hello"}, function () {
window.top.location.href = APP.base + URL.replace('https://www.facebook.com/connect/login_success.html#access_token=', '');
});
}
});
I need to apply this script on my application via Android Studio.