简体   繁体   中英

Block a friend of Facebook from the console of javascript in the browser

I have this variable on my console of Javascript

var f = "https://www.facebook.com/friend.test"

So, how can I block it from the console of Javascript? Is this possible?

I have one idea:

I can go to the page where facebook block people and then do document.getElementById("u_bs_2") ; but I don't know how to send the variable f as parameter, any hint?

IDs are generated dynamically on Facebook; you can't count on them to be consistent. Targeting the associated <form> by its action URL is best.

Theoretically, you should be able to set the .value of the form's text input to your URL, then programatically submit the form:

document.querySelector('form[action="/ajax/privacy/block_dispatcher/"] input[type="text"]').value = f;
document.querySelector('form[action="/ajax/privacy/block_dispatcher/"]').submit();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM