mee*_*ena -2 html javascript css php
我有一个视频文件列表并使用锚标记来显示它们。我想在没有下载或保存按钮的情况下播放视频。我已经禁用了右键单击选项,但仍然在某些浏览器中,单击链接会直接下载文件。谁能告诉我如何避免它?我使用了以下代码:
<!DOCTYPE html>
<html>
<head>
<script language='JavaScript' type='text/JavaScript'>
// http://htmlgenerator.weebly.com
var tenth = '';
function ninth() {
if (document.all) {
(tenth);
alert("Right Click Disable");
return false;
}
}
function twelfth(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
(tenth);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = twelfth;
} else {
document.onmouseup = twelfth;
document.oncontextmenu = ninth;
}
document.oncontextmenu = new Function('alert("Right Click Disable"); return false')
</script>
</head>
<body>
<h1>video</h1>
<a href="barsandtone.flv" target="_blank" >Video1</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
小智 5
使用 HTML5 Video 标签。
示例(来自 W3schools):
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>.