So I am trying to create a basic site that has a input box that can be used to input a URL, once a button is pressed the URL that is inputed will turn into a iframe under the input.
(My school doesn’t block sites in iframes so this will be used to unblock sites.)
Add a default iframe with an id. It needs a src, but many sites, including ‘google.com’ will refuse to load inside an iframe (this might be a problem for your idea in general…)
Change unblock to unblock() as above; you need to call the function by adding the parentheses.
You were pretty close with your script js:
function unblock() {
let iframe = document.getElementById('newSite');
let url = document.getElementById('url');
iframe.src = url.value;
}
Grab the iframe, grab the url. You need to use url.value to get what was typed into the box. Use it to set iframe.src.
Works for me in my tests, but beware some sites that don’t load, and if you’re using the https version of your glitch app, you can only load https addresses.