I was wondering if I could use an Iframe and about:blank code and embed thos two so that when I press the button, my Iframe code will open in a new tab with the link as about:blank. Can anyone help me please? Thanks!
Here is the about:blank code which I have:
<html>
<head>
</head>
<body>
<button onclick="openGame()"><html>
<head>
</head>
<body>
<button onclick="openGame()">Open Game</button>
<script>
function openGame() {
var win = window.open()
var url = ""
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = url
win.document.body.appendChild(iframe)
}
</script>
</body>
</html></button>
<script>
function openGame() {
var win = window.open()
var url = "insert the URL here"
var iframe = win.document.createElement('iframe')
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.src = url
win.document.body.appendChild(iframe)
}
</script>
</body>
</html>
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').