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

About RTPMatt

I'm a Software Engineer Living in Asheville, NC. I specialize in Front-End development, currency with AngularJS.
This entry was posted in javascript, Netflix, programming and tagged . Bookmark the permalink.

3 Responses to I Don’t Like Being Told What I Can and Can’t Do

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

  2. petey says:

    Re:
    1.Object.defineProperty(window, “console”, {
    2.get: undefined,
    3.set: undefined
    4.});

    I HAVE NEVER STUDIED CODE (yet). (Sorry for all caps). I notice the Netflix “fix” starts “Object…” on line 4, you begin Line 1. Is this important? or do I add this BEFORE or AFTER the Netflix goop?

    And of course this is easy to make into a bookmarklet like so:
    What is a bookmarklet and where do I place the following: “Enable Console”?

    As I mentioned in a previous comment, the fact that the last update was 2.5 years ago and I use OSX, means I won’t be trying your extension yet but to get in and check out the code would be very interesting.

Leave a Reply to petey Cancel reply

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