JSFiddle - React, Tailwind, and code Playground

by James Greene

JavaScript

try {
    var top;
    if (typeof top === "undefined" &&
        typeof window.top === "undefined" &&
        typeof this.top === "undefined")
    {
        console.log("Successfully hid: `top`");
    }
    else {
        console.log("Failed to hide: `top`");
    }
}
catch (e) {
    console.log("ERROR! Died while trying to hide `top`.\n" + e);
}

try {
    var opener;
    if (typeof opener === "undefined" &&
        typeof window.opener === "undefined" &&
        typeof this.opener === "undefined")
    {
        console.log("Successfully hid: `opener`");
    }
    else {
        console.log("Failed to hide: `opener`");
    }
}
catch (e) {
    console.log("ERROR! Died while trying to hide `opener`.\n" + e);
}

try {
    var parent;
    if (typeof parent === "undefined" &&
        typeof window.parent === "undefined" &&
        typeof this.parent === "undefined")
    {
        console.log("Successfully hid: `parent`");
    }
    else {
        console.log("Failed to hide: `parent`");
    }
}
catch (e) {
    console.log("ERROR! Died while trying to hide `parent`.\n" + e);
}

try {
    var eval;
    if (typeof eval === "undefined" &&
        typeof window.eval === "undefined" &&
        typeof this.eval === "undefined")
    {
        console.log("Successfully hid: `eval`");
    }
    else {
        console.log("Failed to hide: `eval`");
    }
}
catch (e) {
    console.log("ERROR! Died while trying to hide `eval`.\n" + e);
}

try {
    var document;
    if (typeof document === "undefined" &&
        typeof window.document === "undefined" &&
        typeof this.document === "undefined")
    {
        console.log("Successfully hid: `document`");
    }
    else {
        console.log("Failed to hide: `document`");
    }
}
catch (e) {
    console.log("ERROR! Died while trying to hide `document`.\n" + e);
}

try {
    var window;
    if (typeof window === "undefined") {
        console.log("Successfully hid: `window`");
    }
    else {
        console.log("Failed to hide:...