I was trying to update my Netflix autoplay bookmarklet since the autoplay feature that Netflix came out with is…not great. What I found was that Netflix tried to disable the console. Well, that became a more interesting problem to solve…and quite an easy one too. The code Netflix uses to disable the console is:
(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$$) {} })();
To undo this is actually really simple, we just need to set the getter/setter back to 'undefined' and everything is happy:
Object.defineProperty(window, "console", { get: undefined, set: undefined });
And of course this is easy to make into a bookmarklet like so:
Enable Console
Sorry Netflix =)