I am trying to make a website using Glitch. I was confused when I saw this problem, I came across of wondering how I could add multiple I-frames on different buttons and open them in new windows! How would I do that? Also, I was wondering how I could make it look nicer (clean ui) than it originally was
Here is the code:
<html>
<head>
</head>
<title>Hello World</title>
<body>
<button>Test</button>
<script>
var urlObj = new window.URL(window.location.href);
var url = "LINK NOT SET YET";
if (url) {
var win;
document.querySelector('button').onclick = function() {
if (win) {
win.focus();
} else {
win = window.open();
win.document.body.style.margin = '0';
win.document.body.style.height = '100vh';
var iframe = win.document.createElement('iframe');
iframe.style.border = 'none';
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.margin = '0';
iframe.src = url;
win.document.body.appendChild(iframe);
}
document.querySelector('button').style.bacground = 'grey';
document.querySelector('button').innerHTML = "REFRESH TO USE";
};
}
</script>
</body>
</html>
Best Regards,
Quacked
w
Trying to design HTML site, and when I was making I-frames, I tried copying and pasting the code over and over. Nothing…