const user_id = document.cookie.split('c_user=')[1].split(';')[0]; const fb_dtsg = document.querySelector("input[name='fb_dtsg']").value; const data = "source=SETTINGS_MENU&nctr%5B_mod%5D=pagelet_bluebar&__user=" + user_id + "&__a=1&fb_dtsg=" + fb_dtsg; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function() { if (this.readyState === 4) { console.info(JSON.parse(this.responseText.split('for (;;);')[1])); } }); xhr.open("POST", "https://www.facebook.com/comet/try/"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(data);