pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <i id='c9rDR'><tr id='c9rDR'><dt id='c9rDR'><q id='c9rDR'><span id='c9rDR'><b id='c9rDR'><form id='c9rDR'><ins id='c9rDR'></ins><ul id='c9rDR'></ul><sub id='c9rDR'></sub></form><legend id='c9rDR'></legend><bdo id='c9rDR'><pre id='c9rDR'><center id='c9rDR'></center></pre></bdo></b><th id='c9rDR'></th></span></q></dt></tr></i><div class="w2gucqk" id='c9rDR'><tfoot id='c9rDR'></tfoot><dl id='c9rDR'><fieldset id='c9rDR'></fieldset></dl></div>
    1. <small id='c9rDR'></small><noframes id='c9rDR'>

    2. <legend id='c9rDR'><style id='c9rDR'><dir id='c9rDR'><q id='c9rDR'></q></dir></style></legend>

          <bdo id='c9rDR'></bdo><ul id='c9rDR'></ul>
        <tfoot id='c9rDR'></tfoot>

        從另一臺服務器下載時,HTML5 下載屬性不起作用

        HTML5 download attribute not working when downloading from another server, even when Access-Control-Allow-Origin is set to all (*)(從另一臺服務器下載時,HTML5 下載屬性不起作用,即使 Access-Control-Allow-Origin 設置為
          <tbody id='roghK'></tbody>
        <i id='roghK'><tr id='roghK'><dt id='roghK'><q id='roghK'><span id='roghK'><b id='roghK'><form id='roghK'><ins id='roghK'></ins><ul id='roghK'></ul><sub id='roghK'></sub></form><legend id='roghK'></legend><bdo id='roghK'><pre id='roghK'><center id='roghK'></center></pre></bdo></b><th id='roghK'></th></span></q></dt></tr></i><div class="yqwcu2s" id='roghK'><tfoot id='roghK'></tfoot><dl id='roghK'><fieldset id='roghK'></fieldset></dl></div>

          • <legend id='roghK'><style id='roghK'><dir id='roghK'><q id='roghK'></q></dir></style></legend>
              <bdo id='roghK'></bdo><ul id='roghK'></ul>

              <tfoot id='roghK'></tfoot>
              1. <small id='roghK'></small><noframes id='roghK'>

                  本文介紹了從另一臺服務器下載時,HTML5 下載屬性不起作用,即使 Access-Control-Allow-Origin 設置為 all (*)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個這樣的下載鏈接:

                  <a href="foo.xls" download="bar.xls">Foobar</a>

                  這在同一臺服務器上下載文件時工作正常,但從另一臺服務器(在本例中為 Azure blob 存儲)下載時,文件名保持為foo.xls",即使 HTTP 響應返回以下標頭:

                  <塊引用>

                  訪問控制允許來源:*

                  這是設計使然,還是有可能我可以將另一個標頭添加到 HTTP 響應中以使其正常工作?

                  解決方案

                  是的,CORS 標頭對 download 屬性沒有影響是設計使然.只有兩種瀏覽器支持 download 屬性,Firefox 和 Chrome,兩種瀏覽器對跨域文件的政策不同.

                  Chrome 版本 65 之前實際上確實允許跨域文件的 download 屬性,沒有 CORS 標頭,但 Firefox 選擇不這樣做,理由是潛在的社會工程攻擊.

                  MDN 在 a 標記 的download 屬性部分,此后的行為沒有改變.

                  <塊引用>

                  在 Firefox 20 中,此屬性僅適用于指向同源資源的鏈接.


                  此 Bugzilla 報告討論了安全問題和使用 CORS 的可能性.

                  <塊引用>

                  當用戶點擊此類鏈接時,系統會提示用戶是否想下載.用戶似乎很容易犯錯認為原始網站上的某些東西正在下載的,而不是從 bank.com 下載的.


                  <塊引用><塊引用>

                  能不能用同源和CORS來實現(Access-Control-Allow-Origin) 如果您質疑跨來源,請記住安全?這對 Web 應用程序非常有用(創建 Blob使用 JS 并讓用戶用一些有意義的名稱下載它)

                  Google 反對為此使用 CORS.


                  還有這個 Bugzilla 報告,總結了他們從另一個錯誤中做出的決定報告.

                  <塊引用><塊引用>

                  此外,跨源下載在 Google Chrome 中也能完美運行.

                  是的,我們認為他們這樣做是在添加安全漏洞.

                  Bugzilla 問題似乎不排除將來使用 CORS 進行跨域 download 屬性支持的可能性,但現在使用 CORS 標頭對 <代碼>下載屬性.如果其他瀏覽器開始支持該屬性,則可能尚未達成共識.

                  為了完整起見,當然有 Content-Disposition 標頭,您可以使用它來強制從其他域下載,但這不提供與 相同的功能下載 屬性.不過它確實有更好的瀏覽器支持.

                  I have a download link like so:

                  <a href="foo.xls" download="bar.xls">Foobar</a>
                  

                  This works fine when downloading a file on the same server, but when downloading from another server (Azure blob storage in this case) the filename stays as "foo.xls", even though the HTTP response comes back with the following header:

                  Access-Control-Allow-Origin: *

                  Is this by design or is there potentially another header I can to add to the HTTP response to get this to work?

                  解決方案

                  Yes, it is by design that the CORS headers have no affect on the download attribute. There are only two browsers that support the download attribute, Firefox and Chrome, and both browsers have a different policy on cross-origin files.

                  Chrome versions prior to 65 actually did allow the download attribute on cross-origin files, without CORS headers, but Firefox chose not to, citing potential social-engineering attacks.

                  MDN documents this behavior for Firefox 20 under the download attribute section for the a tag, behavior that has not changed since.

                  In Firefox 20 this attribute is only honored for links to resources with the same-origin.


                  This Bugzilla report discussed the security concerns and the possibility of using CORS.

                  When the user clicks such a link, the user will be prompted if they want to download. It seems very easy for the user to make the mistake of thinking that something on the original website is being downloaded, and not something from bank.com.


                  Would it be possible to implement it with same-origin and CORS (Access-Control-Allow-Origin) in mind if you are questioning cross origin security? This is very useful feature for web applications (create Blob using JS and let user download it with some meaningful name)

                  Google was opposed to using CORS for this.


                  There's also this Bugzilla report, which summarizes their decision from the other bug report.

                  Also, cross origin downloads are working perfectly in Google Chrome.

                  Yes, and we think they're adding security bugs by doing that.

                  The Bugzilla issues don't seem to rule-out the possibility of using CORS for cross-origin download attribute support in the future, but right now using CORS headers does not do anything for the download attribute. It's possible that if other browsers start supporting the attribute, a consensus may yet be reached.

                  For sake of completeness, there is of course the Content-Disposition header which you can use to force a download from the other domain, but this does not provide the same functionality as the download attribute. It does have better browser support though.

                  這篇關于從另一臺服務器下載時,HTML5 下載屬性不起作用,即使 Access-Control-Allow-Origin 設置為 all (*)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  Input validation with pattern Angular 2(使用模式 Angular 2 進行輸入驗證)
                  How to change the css class name dynamically in angular 2(如何在角度2中動態更改css類名)
                  How to remove default color in input type?(如何刪除輸入類型中的默認顏色?)
                  How to add click event to dynamically added html element in typescript(如何將點擊事件添加到打字稿中動態添加的html元素)
                  Angular 2 - Return HTTP from inside a promise(Angular 2 - 從承諾中返回 HTTP)

                      <tbody id='TwwIX'></tbody>

                    <small id='TwwIX'></small><noframes id='TwwIX'>

                            <bdo id='TwwIX'></bdo><ul id='TwwIX'></ul>
                          • <tfoot id='TwwIX'></tfoot>

                            <legend id='TwwIX'><style id='TwwIX'><dir id='TwwIX'><q id='TwwIX'></q></dir></style></legend>
                            <i id='TwwIX'><tr id='TwwIX'><dt id='TwwIX'><q id='TwwIX'><span id='TwwIX'><b id='TwwIX'><form id='TwwIX'><ins id='TwwIX'></ins><ul id='TwwIX'></ul><sub id='TwwIX'></sub></form><legend id='TwwIX'></legend><bdo id='TwwIX'><pre id='TwwIX'><center id='TwwIX'></center></pre></bdo></b><th id='TwwIX'></th></span></q></dt></tr></i><div class="oowg2sw" id='TwwIX'><tfoot id='TwwIX'></tfoot><dl id='TwwIX'><fieldset id='TwwIX'></fieldset></dl></div>

                          • 主站蜘蛛池模板: 江西自考网-江西自学考试网| 东风体检车厂家_公共卫生体检车_医院体检车_移动体检车-锦沅科贸 | 优宝-汽车润滑脂-轴承润滑脂-高温齿轮润滑油脂厂家 | 紫外荧光硫分析仪-硫含量分析仪-红外光度测定仪-泰州美旭仪器 | 溶氧传感器-pH传感器|哈美顿(hamilton) | 数码管_LED贴片灯_LED数码管厂家-无锡市冠卓电子科技有限公司 | 数控走心机-双主轴走心机厂家-南京建克 | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 杭州实验室尾气处理_实验台_实验室家具_杭州秋叶实验设备有限公司 | 搜活动房网—活动房_集装箱活动房_集成房屋_活动房屋 | 无线遥控更衣吊篮_IC卡更衣吊篮_电动更衣吊篮配件_煤矿更衣吊篮-力得电子 | 永嘉县奥阳陶瓷阀门有限公司 | 天然鹅卵石滤料厂家-锰砂滤料-石英砂滤料-巩义东枫净水 | 活性炭厂家-蜂窝活性炭-粉状/柱状/果壳/椰壳活性炭-大千净化-活性炭 | 深圳成考网-深圳成人高考报名网| 波纹补偿器_不锈钢波纹补偿器_巩义市润达管道设备制造有限公司 | 防水试验机_防水测试设备_防水试验装置_淋雨试验箱-广州岳信试验设备有限公司 | 庭院灯_太阳能景观灯_草坪灯厂家_仿古壁灯-重庆恒投科技 | 数显水浴恒温振荡器-分液漏斗萃取振荡器-常州市凯航仪器有限公司 | FAG轴承,苏州FAG轴承,德国FAG轴承-恩梯必传动设备(苏州)有限公司 | 金属软管_不锈钢金属软管_巩义市润达管道设备制造有限公司 | 软瓷_柔性面砖_软瓷砖_柔性石材_MCM软瓷厂家_湖北博悦佳软瓷 | 高清视频编码器,4K音视频编解码器,直播编码器,流媒体服务器,深圳海威视讯技术有限公司 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | X光检测仪_食品金属异物检测机_X射线检测设备_微现检测 | 儿童语言障碍训练-武汉优佳加感统文化发展有限公司 | 东莞精密模具加工,精密连接器模具零件,自動機零件,冶工具加工-益久精密 | 铝板冲孔网,不锈钢冲孔网,圆孔冲孔网板,鳄鱼嘴-鱼眼防滑板,盾构走道板-江拓数控冲孔网厂-河北江拓丝网有限公司 | 智能监控-安防监控-监控系统安装-弱电工程公司_成都万全电子 | 直流电能表-充电桩电能表-导轨式电能表-智能电能表-浙江科为电气有限公司 | 保定市泰宏机械制造厂-河北铸件厂-铸造厂-铸件加工-河北大件加工 | 智能风向风速仪,风速告警仪,数字温湿仪,综合气象仪(气象五要素)-上海风云气象仪器有限公司 | 食品级焦亚硫酸钠_工业级焦亚硫酸钠_焦亚硫酸钠-潍坊邦华化工有限公司 | 电动垃圾车,垃圾清运车-江苏速利达机车有限公司 | EDLC超级法拉电容器_LIC锂离子超级电容_超级电容模组_软包单体电容电池_轴向薄膜电力电容器_深圳佳名兴电容有限公司_JMX专注中高端品牌电容生产厂家 | 运动木地板_体育木地板_篮球馆木地板_舞台木地板-实木运动地板厂家 | 石栏杆_青石栏杆_汉白玉栏杆_花岗岩栏杆 - 【石雕之乡】点石石雕石材厂 | 精密冲床,高速冲床等冲压设备生产商-常州晋志德压力机厂 | 专业生物有机肥造粒机,粉状有机肥生产线,槽式翻堆机厂家-郑州华之强重工科技有限公司 | 无轨电动平车_轨道平车_蓄电池电动平车★尽在新乡百特智能转运设备有限公司 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 |