Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 我如何从自己的网页下载firebase中托管的视频(只需单击“a”标记)?_Html_Hyperlink - Fatal编程技术网

Html 我如何从自己的网页下载firebase中托管的视频(只需单击“a”标记)?

Html 我如何从自己的网页下载firebase中托管的视频(只需单击“a”标记)?,html,hyperlink,Html,Hyperlink,所以我有这个网页, 我想点击“a”标签下载视频(在firebase上托管) 我试过这样的东西 <html> <body> <a href="https://firebasestorage.googleapis.com/v0/b/speech-to-text-web.appspot.com/o/dataset%2FAbuse%2Fabusar_x264_0.mp4? alt=media&token=e84607c8-ba77-4c81-99a

所以我有这个网页, 我想点击“a”标签下载视频(在firebase上托管) 我试过这样的东西

 <html>
  <body>
 <a href="https://firebasestorage.googleapis.com/v0/b/speech-to-text-web.appspot.com/o/dataset%2FAbuse%2Fabusar_x264_0.mp4? 
  alt=media&token=e84607c8-ba77-4c81-99a4-bd42d29cc869" 
  download>click</a>
 </body>
 </html>
 


只需将href值移动到下载值即可

<script>
let el = document.querySelectorAll("a");

el.forEach((v)=>{

let url = v.getAttribute("href");

v.href = "";

v.download = url;

});
    </script>

设el=document.queryselectoral(“a”);
el.forEach((v)=>{
让url=v.getAttribute(“href”);
v、 href=“”;
v、 下载=url;
});

在页面上添加此代码,然后单击任何a标记。

也许右键单击就可以了?根据
download
属性仅适用于相同来源的URL,或blob:和data:方案。显然,firebase URl与站点的来源不同,因此该属性无效。除了使用服务器端脚本作为代理,从Firebase获取所需的视频,然后将数据返回到客户端,并带有指示浏览器应该尝试下载而不是显示的标题,我不确定您能做多少。这可能不是很有效,我想我会创建一些Node.js服务来获取视频,然后将其发送到客户端。你能告诉我如何发送正确的标题来告诉浏览器下载数据而不是显示数据吗?我试过了,但不起作用。它不断地将我重定向到链接,你能从外部网站下载视频吗?是的,我在最后添加了“;”,但我只是得到原始HTML,我想要mp4格式的视频