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>

                          • 主站蜘蛛池模板: 北京模型公司-工业模型-地产模型-施工模型-北京渝峰时代沙盘模型制作公司 | 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 采暖炉_取暖炉_生物质颗粒锅炉_颗粒壁炉_厂家加盟批发_烟台蓝澳采暖设备有限公司 | Trimos测长机_测高仪_TESA_mahr,WYLER水平仪,PWB对刀仪-德瑞华测量技术(苏州)有限公司 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 植筋胶-粘钢胶-碳纤维布-碳纤维板-环氧砂浆-加固材料生产厂家-上海巧力建筑科技有限公司 | 安规电容|薄膜电容|陶瓷电容|智旭JEC安规电容厂家 | 食品质构分析仪-氧化诱导分析仪-瞬态法导热系数仪|热冰百科 | 光栅尺厂家_数显表维修-苏州泽升精密机械 | 国产频谱分析仪-国产网络分析仪-上海坚融实业有限公司 | 楼承板-钢筋楼承板-闭口楼承板-无锡优贝斯楼承板厂 | 硫化罐-电加热蒸汽硫化罐生产厂家-山东鑫泰鑫智能装备有限公司 | 精密钢管,冷拔精密无缝钢管,精密钢管厂,精密钢管制造厂家,精密钢管生产厂家,山东精密钢管厂家 | Q361F全焊接球阀,200X减压稳压阀,ZJHP气动单座调节阀-上海戎钛 | 混合气体腐蚀试验箱_盐雾/硫化氢/气体腐蚀试验箱厂家-北京中科博达 | 大型果蔬切片机-水果冬瓜削皮机-洗菜机切菜机-肇庆市凤翔餐饮设备有限公司 | 微水泥_硅藻泥_艺术涂料_艺术漆_艺术漆加盟-青岛泥之韵环保壁材 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 广东泵阀展|阀门展-广东国际泵管阀展览会 | 上海网站建设-上海网站制作-上海网站设计-上海做网站公司-咏熠软件 | 合肥白癜风医院_合肥治疗白癜风医院_合肥看白癜风医院哪家好_合肥华研白癜风医院 | 废气处理_废气处理设备_工业废气处理_江苏龙泰环保设备制造有限公司 | 越南专线物流_东莞国际物流_东南亚专线物流_行通物流 | 编织人生 - 权威手工编织网站,编织爱好者学习毛衣编织的门户网站,织毛衣就上编织人生网-编织人生 | 利浦顿蒸汽发生器厂家-电蒸汽发生器/燃气蒸汽发生器_湖北利浦顿热能科技有限公司官网 | 正压密封性测试仪-静态发色仪-导丝头柔软性测试仪-济南恒品机电技术有限公司 | 十二星座查询(性格特点分析、星座运势解读) - 玄米星座网 | 知企服务-企业综合服务(ZiKeys.com)-品优低价、种类齐全、过程管理透明、速度快捷高效、放心服务,知企专家! | 全自动在线分板机_铣刀式在线分板机_曲线分板机_PCB分板机-东莞市亿协自动化设备有限公司 | 真空上料机(一种真空输送机)-百科| 废旧物资回收公司_广州废旧设备回收_报废设备物资回收-益美工厂设备回收公司 | 合肥展厅设计-安徽展台设计-合肥展览公司-安徽奥美展览工程有限公司 | 硫化罐-胶管硫化罐-山东鑫泰鑫智能装备有限公司 | uv固化机-丝印uv机-工业烤箱-五金蚀刻机-分拣输送机 - 保定市丰辉机械设备制造有限公司 | 旅游规划_旅游策划_乡村旅游规划_景区规划设计_旅游规划设计公司-北京绿道联合旅游规划设计有限公司 | AGV无人叉车_激光叉车AGV_仓储AGV小车_AGV无人搬运车-南昌IKV机器人有限公司[官网] | 杭州网络公司_百度SEO优化-外贸网络推广_抖音小程序开发-杭州乐软科技有限公司 | 便携式谷丙转氨酶检测仪|华图生物科技百科 | 上海网站建设-上海网站制作-上海网站设计-上海做网站公司-咏熠软件 | 许昌奥仕达自动化设备有限公司 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 |