I Don’t Like Being Told What I Can and Can’t Do

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 =)

This entry was posted in javascript, Netflix, programming and tagged . Bookmark the permalink.

One Response to I Don’t Like Being Told What I Can and Can’t Do

  1. Pingback: NEW Netflix Autoplay Bookmarklet! | Mostly Worthless

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>