About Blank experiments

Uploaded on March 2nd, 2024

about:blank is a silly little webpage that, as the name suggests, is about blank. There is nothing on it, except for the boilerplate doctype, html, head, body stuff.
After some "research" and "observations" I soon discovered you can inject tags into the about blank page.

So, lets do that.
I'm going to open a new HTML document and put a button on it.

<!DOCTYPE html>
 <meta charset="utf-8" />
 <button>Open about:blank window</button>

Lets add a script tag in the head and put some code in it.

// note this code will be messy because im trying to make it more beginner friendly i think
function openWindow() {
var about_blank_window = open(); // opens about blank window
var script_tag = about_blank_window.document.createElement("script"); // make script tag

script_tag.innerHTML = "alert(window.location.href);"; // add some JavaScript to display where we are
about_blank_window.document.head.appendChild(script_tag); // add the JavaScript to the DOM

Lets test it out
First, we need to change the button to be <button onclick="openWindow()>Open about:blank window</button> so it opens the window.

And there we have it, our own scripts running inside of an about blank window.