So I want to make the iframe tag react to a variable. How?
Take a look at this one:
<iframe
  width="500"
  height="500"
  src=website
></iframe>
<script>
  var website = document.getElementById("textBox").value;
</script>
So I want to make the iframe tag react to a variable. How?
Take a look at this one:
<iframe
  width="500"
  height="500"
  src=website
></iframe>
<script>
  var website = document.getElementById("textBox").value;
</script>
Solution Here !!!
<script type="text/javascript">
function iframeDidLoad() {
  var website = document.getElementById("textBox").value;
 document.getElementById('myIframe').src =website ;
}
</script>
<iframe
  width="500"
  height="500"
 onLoad="iframeDidLoad();"
  src=""
></iframe>
 
    
    A safer approach is to delegate the action of changing the iframe's src to a click of a button, for example, then you'll avoid the multiple refreshes.
You can run this example right on this very page:
document.querySelector('#changeButton').onclick = function() {
  document.querySelector('#iframex').src = document.querySelector('#textBox').value
}#textBox { width: 75% }
#changeButton { width: 20% }
iframe { width: 95% }<input type="text" id="textBox" value="https://fr.wikipedia.org/wiki/Main_Page" />
<button type="button" id="changeButton">change iframe source</button>
<iframe src="" id="iframex"></iframe>