
Ask HN: How to block Facebook scripts? - pandatigox
I found the &#x27;block&#x27; function of ublock recently and used it to hide my Facebook newsfeed to avoid distractions. But I noticed that the tab would be keep loading and I think it&#x27;s because it&#x27;s trying to load content when there isn&#x27;t any. I would like to block this script - how do I use the console inspector in Firefox and NoScript to find and block the incriminating scripts?
======
clusmore
This is a little off-topic but I find it completely baffling that we seem to
have so little control over the code that is executed on our own machines.
From Javascript on pages to viruses, why is arbitrary software given so much
power? Javascript is a dynamic language, so it should be really easy to remove
its capabilities. Replace the XMLHttpRequest reference with a stub that
requires permission from the user before making any requests. Stub out members
on the global object to prevent access to the DOM. Any capability to annoy the
user, stub it out. Does this kind of tool not exist in the form of a browser
extension? You could define your own script to bork the runtime before control
is given to remote scripts.

The theory[1] for this kind of approach was developed over 50 years ago, I'm
just completely dumbstruck that we haven't properly solved this problem.

[1] [https://en.wikipedia.org/wiki/Object-
capability_model](https://en.wikipedia.org/wiki/Object-capability_model)

------
skylark
I noticed Facebook's JavaScript does weird things if the newsfeed <div> is
removed from the page. Thus the correct way to hide the feed is to set the
<div> to visibility: hidden, but no extension does that afaik.

You can use this bookmarklet to do it:
javascript:(function(){document.querySelector('[role="feed"]').style.visibility
= 'hidden';}());

Or use Greasemonkey/Tampermonkey to run it on page load. Alternatively use
messenger if all you need is to message people.

------
brudgers
I browse Facebook in a separate browser from my main browser...think Edge
versus Firefox versus Chrome etc. This keeps Facebook scripts from firing on
other pages. When I really want to ignore Facebook, I close the window.

------
CinisSec
Honestly if you're concerned about that you should just stop using facebook.

