Skip to content

Instantly share code, notes, and snippets.

@FatihDurmus
Created June 17, 2022 07:18
Show Gist options
  • Save FatihDurmus/9a88734b7c53404953f8a1a36c99e383 to your computer and use it in GitHub Desktop.
Save FatihDurmus/9a88734b7c53404953f8a1a36c99e383 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Change src value of iframe dynamically</title>
<script type="text/javascript">
function newSrc() {
const url = 'https://corsproxy.io?' + encodeURIComponent('https://www.youtube.com');
document.getElementById("myFrame").src = url;
}
let d = new Date();
alert("Today's date is " + d);
</script>
<style type="text/css">
select {clear:both;}
</style>
</head>
<body>
<iframe src="" id="myFrame" onload="newSrc()"></iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment