Skip to content

Instantly share code, notes, and snippets.

@SummonHIM
Created February 26, 2023 12:02
Show Gist options
  • Select an option

  • Save SummonHIM/8c558c5c20d78c54a192ec7746ebeaec to your computer and use it in GitHub Desktop.

Select an option

Save SummonHIM/8c558c5c20d78c54a192ec7746ebeaec to your computer and use it in GitHub Desktop.
网页 URL 播放器
<!DOCTYPE html>
<html lang="zh">
<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>网页 URL 播放器</title>
</head>
<body>
<video controls width="100%" height="100%" style="position: fixed;left: 0; top: 0;" id="player">
你的浏览器不支持访问该网页!
</video>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var videoUrl = urlParams.get("url");
if (videoUrl == undefined) {
console.error("错误:键 'url' 不得为空")
} else if (videoUrl == '') {
console.error("错误:键 'url' 不得为空")
} else {
document.getElementById("player").src = videoUrl
}
</script>
</body>
</html>
<!DOCTYPE html><html lang="zh"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>网页 URL 播放器</title></head><body><video controls width="100%" height="100%" style="position:fixed;left:0;top:0" id="player">你的浏览器不支持访问该网页!</video><script>const queryString=window.location.search;const urlParams=new URLSearchParams(queryString);var videoUrl=urlParams.get("url");if(videoUrl == undefined){console.error("错误:键 'url' 不得为空")}else if(videoUrl == ''){console.error("错误:键 'url' 不得为空")}else{document.getElementById("player").src = videoUrl}</script></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment