Skip to content

Instantly share code, notes, and snippets.

@duydev
Created October 22, 2019 19:43
Show Gist options
  • Save duydev/17254724170d976771f152018966475c to your computer and use it in GitHub Desktop.
Save duydev/17254724170d976771f152018966475c to your computer and use it in GitHub Desktop.
Script to force enroll facebook ui beta
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment