<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <style>
        /* Main Page Styles */
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(135deg, #4facfe, #00f2fe);
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            flex-direction: column;
            text-align: center;
        }

        h1 {
            margin-bottom: 20px;
            font-size: 2rem;
            text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
        }

        button {
            background-color: #008CBA;
            color: white;
            border: none;
            padding: 10px 20px;
            font-size: 1.2rem;
            cursor: pointer;
            border-radius: 5px;
            box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
            transition: background-color 0.3s ease;
        }

        button:hover {
            background-color: #005f73;
        }

        input {
            padding: 10px;
            width: 60%;
            font-size: 1rem;
            margin-bottom: 20px;
            border-radius: 5px;
            border: none;
            box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
        }

        iframe {
            border: none;
        }
    </style>
</head>

<body>
    <h3>nopas</h3>
    <input id="url" placeholder="https://classic.minecraft.net/" />
    <br>
    <button onclick="z40();">Click Me</button>
    <script>
        function z40() {
            let inputUrl = document.getElementById("url").value.trim();

            // Add https:// if the URL doesn't already start with http:// or https://
            if (!inputUrl.startsWith("http://") && !inputUrl.startsWith("https://")) {
                inputUrl = "https://" + inputUrl;
                alert("URL adjusted to: " + inputUrl); // Optional for debugging
            }

            try {
                let runner = window.open("", "_blank", "noopener");
                if (!runner) {
                    alert("Popup blocked. Please allow popups for this site.");
                    return;
                }

                runner.document.write(`
                    <!DOCTYPE html>
                    <html lang="en">
                    <head>
                        <meta charset="UTF-8">
                        <meta name="viewport" content="width=device-width, initial-scale=1.0">
                        <title>Iframe Page</title>
                        <style>
                            body {
                                margin: 0;
                                background: linear-gradient(135deg, #ff7eb3, #ff758c);
                                display: flex;
                                justify-content: center;
                                align-items: center;
                                height: 100vh;
                            }
                            iframe {
                                width: 100%;
                                height: 100%;
                                border: none;
                            }
                        </style>
                    </head>
                    <body>
                        <iframe src="${inputUrl}" width="100%" height="100%"></iframe>
                    </body>
                    </html>
                `);
            } catch (error) {
                console.error("Error loading the iframe:", error);
                alert("Failed to load the iframe. Check the console for details.");
            }
        }
    </script>
</body>

</html>
