how to set page title on about:blank website

2.1k Views Asked by At

I am making a school game unblocker website and am using about:blank cloaking. I need to add a title to the about:blank site so that teachers won't see what I am on.

This is the code for the redirection.

<html>

<head>


<body onclick="MyWindow1()">Click here to start</body>



</head>

<script>

(url);

var newWin = window.open
function MyWindow1(){

var win = window.open()
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = "./Main.html";
win.document.body.appendChild(iframe)
location.replace("https://www.google.com/")
}



</script>

</html>

This is what the Main.html code looks like. This is the about:blank site.

<html>

<head>


<body onclick="MyWindow1()">Click here to start</body>



</head>

<script>

(url);

var newWin = window.open
function MyWindow1(){

var win = window.open()
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = "./Main.html";
win.document.body.appendChild(iframe)
location.replace("https://www.google.com/")
}



</script>

</html>

If i just run the second file, it does not do the about:blank but does show the title. Thank you!

2

There are 2 best solutions below

0
On BEST ANSWER

You can set the title of the new window using win.document.title = "Your Title Here";

Example:

<script>
    (url);
    var newWin = window.open
    function MyWindow1() {
        var win = window.open()
        win.document.title = "Your Title Here";
        var iframe = win.document.createElement('iframe')
        iframe.style.width = "100%";
        iframe.style.height = "100%";
        iframe.style.border = "none";
        iframe.src = "./Main.html";
        win.document.body.appendChild(iframe);
        location.replace("https://www.google.com/");
    }
</script>
0
On

You don't need to. The page will not be displayed, and neither will the page title, on any screen viewing application.