javascript - Get URL # fragment XMLHttpRequest -
im building chrome extension allow user select facebook posts , send them server.
i have xmlhttprequest sending facebook in order receive access token follows:
function gettoken() { var xhr = new xmlhttprequest(); xhr.open("get", "https://www.facebook.com/dialog/oauth?client_id=my_app_id_here&redirect_uri=https://www.facebook.com/connect/login_success.html&response_type=token"); xhr.send(); xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status == 200) { xxxxxxxxxxxxxxxxxx xhr.close; } }
}
the xmlhttprequest sent server successful , receive access token in response dont know how access it.
if have console window open on chrome , select network tab, can see request being sent, , response being received (with access token) received url fragment , don't have clue how access it.
gettoken function executed in content script if makes difference.
edit:
xhr.responsetext follows
success
security warning: please treat url above password , not share anyone.settimeout(function() {window.history.replacestate && window.history.replacestate({}, "", "blank.html#=");},500);
xhr.responsexml follows
null
can please post response, executing console.log(xhr.response, xhr.responsetext) , post here (modifying accordingly dummy data)? think need manipulate strings value need.
Comments
Post a Comment