How does Facebook disable the browser's integrated Developer Tools?

后端 未结 12 978
予麋鹿
予麋鹿 2020-11-22 06:12

So apparently because of the recent scams, the developer tools is exploited by people to post spam and even used to \"hack\" accounts. Facebook has blocked the developer too

12条回答
  •  粉色の甜心
    2020-11-22 06:49

    Netflix also implements this feature

    (function() {
        try {
            var $_console$$ = console;
            Object.defineProperty(window, "console", {
                get: function() {
                    if ($_console$$._commandLineAPI)
                        throw "Sorry, for security reasons, the script console is deactivated on netflix.com";
                    return $_console$$
                },
                set: function($val$$) {
                    $_console$$ = $val$$
                }
            })
        } catch ($ignore$$) {
        }
    })();
    

    They just override console._commandLineAPI to throw security error.

提交回复
热议问题