Created
September 15, 2022 06:50
-
-
Save Ben-Karr/a8bab8264f033a64dcfa04cfb3de049a to your computer and use it in GitHub Desktop.
embed a youtube video into a plain webpage to keep yourself from strolling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Restrict Youtube</title> | |
<script type="text/javascript"> | |
function load_video(){ | |
var youtube_frame = document.getElementById("youtube_frame"); | |
var youtube_id = document.getElementById("youtube_id"); | |
var youtube_url = "https://www.youtube.com/embed/" + youtube_id.value; | |
console.log(youtube_url) | |
youtube_frame.innerHTML = '<iframe width="420" height="315" frameborder="0" allowfullscreen src="'+ youtube_url + '"></iframe>' | |
} | |
</script> | |
</head> | |
<body> | |
<p id="YT-ID"> | |
<form>Youtube ID: | |
<input type="text" id="youtube_id"/> | |
<input type="button" value="Commit" onclick="load_video();"/> | |
</form> | |
</p> | |
<p id = "youtube_frame"> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment