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

    <tfoot id='qnUvj'></tfoot>

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

      • <bdo id='qnUvj'></bdo><ul id='qnUvj'></ul>
      <i id='qnUvj'><tr id='qnUvj'><dt id='qnUvj'><q id='qnUvj'><span id='qnUvj'><b id='qnUvj'><form id='qnUvj'><ins id='qnUvj'></ins><ul id='qnUvj'></ul><sub id='qnUvj'></sub></form><legend id='qnUvj'></legend><bdo id='qnUvj'><pre id='qnUvj'><center id='qnUvj'></center></pre></bdo></b><th id='qnUvj'></th></span></q></dt></tr></i><div class="nbr5dz7" id='qnUvj'><tfoot id='qnUvj'></tfoot><dl id='qnUvj'><fieldset id='qnUvj'></fieldset></dl></div>
    1. <legend id='qnUvj'><style id='qnUvj'><dir id='qnUvj'><q id='qnUvj'></q></dir></style></legend>
    2. 文件 URL “不允許加載本地資源"在 Internet 瀏

      File URL quot;Not allowed to load local resourcequot; in the Internet Browser(文件 URL “不允許加載本地資源在 Internet 瀏覽器中)

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

        <i id='NLiTY'><tr id='NLiTY'><dt id='NLiTY'><q id='NLiTY'><span id='NLiTY'><b id='NLiTY'><form id='NLiTY'><ins id='NLiTY'></ins><ul id='NLiTY'></ul><sub id='NLiTY'></sub></form><legend id='NLiTY'></legend><bdo id='NLiTY'><pre id='NLiTY'><center id='NLiTY'></center></pre></bdo></b><th id='NLiTY'></th></span></q></dt></tr></i><div class="5pv5vrr" id='NLiTY'><tfoot id='NLiTY'></tfoot><dl id='NLiTY'><fieldset id='NLiTY'></fieldset></dl></div>

          <tbody id='NLiTY'></tbody>

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

                本文介紹了文件 URL “不允許加載本地資源"在 Internet 瀏覽器中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我有一個重要的腦筋急轉彎.

                我想用經典的 ASP 打開一個文件.我正在使用各種變量,因為事情可能會改變,但結果是正確的.我知道這一點是因為我已經通過復制鏈接地址并將其放在我的 URL 中來測試結果.現在的問題是:如果我點擊我的鏈接,它不會做任何事情.不是刷新,不是重定向.沒有什么.有誰知道我做錯了什么?

                好的,這就是交易.我的文件并不總是本地的,這取決于我所處的環境.如果我復制粘貼我的網址的結果,它會下載.如果我單擊我的 URL,它不會響應.有任何想法嗎?瀏覽器問題?(雖然我已經測試了 5 個瀏覽器)還是別的什么?我真的被困在這里,互聯網似乎不在我這邊.

                我有 3 個環境.這里下面的變量是為了使鏈接有效.我知道該鏈接有效,因為我已經通過復制對其進行了測試.是的,它確實以 file:/// 開頭,是的,我確定鏈接是正確的.

                這是我的代碼行:

                response.write("<td class='tab_kolom2'><a href='"&rootRs("pre_rootpad")&rootRs("rootpad_protocollen")&""&overzichtRs("Formuliernr")&"Uitvoeringsoverzicht.xls' target='_blank' 下載>點擊這里</a></td>")

                <小時>

                帶有錯誤/鏈接結果的屏幕截圖

                解決方案

                現在我們知道實際的錯誤是什么,可以制定答案了.

                <塊引用>

                不允許加載本地資源

                是 Chrome 和其他現代瀏覽器中內置的安全異常.措辭可能不同,但在某種程度上,它們都有安全例外來處理這種情況.

                過去您可以覆蓋某些設置或應用某些標志,例如

                <上一頁>--disable-web-security --allow-file-access-from-files --allow-file-access

                在 Chrome 中(參見 https://stackoverflow.com/a/22027002/692942)

                <塊引用>

                它的存在是有原因的

                盡管在這一點上值得指出,這些安全異常的存在是有充分理由的,試圖規避它們并不是最好的主意.

                還有一種方法

                由于您已經可以訪問 Classic ASP,因此您始終可以構建一個為基于網絡的文件提供服務的中間頁面.您可以結合使用 ADODB.Stream 對象和 Response.BinaryWrite() 方法來執行此操作.這樣做可確保您的網絡文件位置永遠不會暴露給客戶端,并且由于腳本的靈活性,它可用于從多個位置和多種文件類型加載資源.

                這是一個基本示例(getfile.asp"):

                <%選項顯式Dim s, id, bin, file, 文件名, mimeid = Request.QueryString(id")'id 可以是任何東西,只需將其用作識別'文件返回.這可能是一個像這樣的簡單案例陳述'甚至從數據庫中提取.選擇案例編號案例TESTFILE1"'文件、mime 和文件名無論如何都可以建立'必須進行硬編碼.文件 = \servershareProjectenProtocollen346Uitvoeringsoverzicht.xls"mime =應用程序/vnd.ms-excel";'下載資源時要顯示的文件名.文件名=Uitvoeringsoverzicht.xls";'假設其他文件案件 ...結束選擇如果 Len(file & ">)0 然后設置 s = Server.CreateObject("ADODB.Stream")s.Type = adTypeBinary 'adTypeBinary = 1 見有用的鏈接"調用 s.Open()調用 s.LoadFromFile(file)bin = s.Read()'清理流并釋放內存調用 s.Close()設置 s = 無'根據 mime 變量設置內容類型頭Response.ContentType = mime'控制如何使用'內容處置 HTTP 標頭.使用附件"強制資源'在內聯"時提示客戶端下載允許資源'下載并在客戶端顯示(用于返回圖片'作為'src'一個<img>標簽).調用 Response.AddHeader("Content-Disposition", "attachment;filename="; & filename)調用 Response.BinaryWrite(bin)別的'如果沒有文件,則返回 404.Response.Status = 404 Not Found"萬一%>

                這個例子是偽編碼的,因此未經測試.

                然后可以像這樣在 <a> 中使用這個腳本來返回資源;

                <a href="/getfile.asp?id=TESTFILE1">點擊這里</a>

                可以進一步采用這種方法并考慮(尤其是對于較大的文件)使用Response.IsConnected分塊讀取文件以檢查客戶端是否仍然存在并且s.EOS 屬性用于在讀取塊時檢查流的結尾.您還可以添加到查詢字符串參數以設置是否希望文件返回內聯或提示下載.


                有用的鏈接

                • 使用 METADATA 導入 DLL 常量 - 如果您無法識別 adTypeBinary,總是比硬編碼 1 更好.

                • Content-Disposition:inline"和attachment"有什么區別? - 有用信息關于 Content-Disposition 在客戶端上的行為方式.

                I've got a major brainteaser.

                I want to open a file in classic ASP. I'm using various variables because things can change but the outcome is correct. I know this because I've tested the outcome by copying the linkadress and placing it in my URL. Now the problem: If I click my link it doesn't do anything. Not a refresh, not a redirect. nothing. Does anyone know what I did wrong?

                Ok here's the deal. My file isn't always local, it depends on what environment I'm on. If I copy-paste the outcome of my url it does download. If I click my URL it doesn't respond. Any ideas? Browser problem? (although I've tested 5 browsers) Or anything else? I'm really stuck here and the internet does not seem to be on my side.

                I've got 3 environments. The variables underneath here are so that the link works. I know the link works because I've tested it by copying. And yes, it does begin with file:/// and yes I'm sure the link is right.

                Here's my line of code:

                response.write("<td class='tab_kolom2'><a href='"&rootRs("pre_rootpad")&rootRs("rootpad_protocollen")&""&overzichtRs("Formuliernr")&"Uitvoeringsoverzicht.xls' target='_blank' download>Click here</a></td>")
                


                EDIT: Screenshot with error/outcome of link

                解決方案

                Now we know what the actual error is can formulate an answer.

                Not allowed to load local resource

                is a Security exception built into Chrome and other modern browsers. The wording may be different but in some way shape or form they all have security exceptions in place to deal with this scenario.

                In the past you could override certain settings or apply certain flags such as

                --disable-web-security --allow-file-access-from-files --allow-file-access
                

                in Chrome (See https://stackoverflow.com/a/22027002/692942)

                It's there for a reason

                At this point though it's worth pointing out that these security exceptions exist for good reason and trying to circumvent them isn't the best idea.

                There is another way

                As you have access to Classic ASP already you could always build a intermediary page that serves the network based files. You do this using a combination of the ADODB.Stream object and the Response.BinaryWrite() method. Doing this ensures your network file locations are never exposed to the client and due to the flexibility of the script it can be used to load resources from multiple locations and multiple file types.

                Here is a basic example ("getfile.asp"):

                <%
                Option Explicit
                
                Dim s, id, bin, file, filename, mime
                
                id = Request.QueryString("id")
                
                'id can be anything just use it as a key to identify the 
                'file to return. It could be a simple Case statement like this
                'or even pulled from a database.
                Select Case id
                Case "TESTFILE1"
                  'The file, mime and filename can be built-up anyway they don't 
                  'have to be hard coded.
                  file = "\servershareProjectenProtocollen346Uitvoeringsoverzicht.xls"     
                  mime = "application/vnd.ms-excel"
                  'Filename you want to display when downloading the resource.
                  filename = "Uitvoeringsoverzicht.xls"
                
                'Assuming other files 
                Case ...
                End Select
                
                If Len(file & "") > 0 Then
                  Set s = Server.CreateObject("ADODB.Stream")
                  s.Type = adTypeBinary 'adTypeBinary = 1 See "Useful Links"
                  Call s.Open()
                  Call s.LoadFromFile(file)
                  bin = s.Read()
                
                  'Clean-up the stream and free memory
                  Call s.Close()
                  Set s = Nothing
                
                  'Set content type header based on mime variable
                  Response.ContentType = mime
                  'Control how the content is returned using the 
                  'Content-Disposition HTTP Header. Using "attachment" forces the resource
                  'to prompt the client to download while "inline" allows the resource to
                  'download and display in the client (useful for returning images
                  'as the "src" of a <img> tag).
                  Call Response.AddHeader("Content-Disposition", "attachment;filename=" & filename)
                  Call Response.BinaryWrite(bin)
                Else
                  'Return a 404 if there's no file.
                  Response.Status = "404 Not Found"
                End If
                %>
                

                This example is pseudo coded and as such is untested.

                This script can then be used in <a> like this to return the resource;

                <a href="/getfile.asp?id=TESTFILE1">Click Here</a>
                

                The could take this approach further and consider (especially for larger files) reading the file in chunks using Response.IsConnected to check whether the client is still there and s.EOS property to check for the end of the stream while the chunks are being read. You could also add to the querystring parameters to set whether you want the file to return in-line or prompt to be downloaded.


                Useful Links

                • Using METADATA to Import DLL Constants - If you are having trouble getting adTypeBinary to be recongnised, always better then just hard coding 1.

                • Content-Disposition:What are the differences between "inline" and "attachment"? - Useful information about how Content-Disposition behaves on the client.

                這篇關于文件 URL “不允許加載本地資源"在 Internet 瀏覽器中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中獲取響應 url?)
                document.write() overwriting the document?(document.write() 覆蓋文檔?)
                AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https(AngularJS 錯誤:跨源請求僅支持協議方案:http、data、chrome-extension、https) - IT屋-程序員軟件開發技術分
                IE10 and Cross-origin resource sharing (CORS) issues with Image / Canvas(IE10 和 Image/Canvas 的跨域資源共享 (CORS) 問題)
                Importing script with type=module from local folder causes a CORS issue(從本地文件夾導入 type=module 的腳本會導致 CORS 問題)

                • <tfoot id='P18sk'></tfoot>

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

                      <tbody id='P18sk'></tbody>
                    1. <legend id='P18sk'><style id='P18sk'><dir id='P18sk'><q id='P18sk'></q></dir></style></legend>
                      • <i id='P18sk'><tr id='P18sk'><dt id='P18sk'><q id='P18sk'><span id='P18sk'><b id='P18sk'><form id='P18sk'><ins id='P18sk'></ins><ul id='P18sk'></ul><sub id='P18sk'></sub></form><legend id='P18sk'></legend><bdo id='P18sk'><pre id='P18sk'><center id='P18sk'></center></pre></bdo></b><th id='P18sk'></th></span></q></dt></tr></i><div class="drpn57z" id='P18sk'><tfoot id='P18sk'></tfoot><dl id='P18sk'><fieldset id='P18sk'></fieldset></dl></div>

                          <bdo id='P18sk'></bdo><ul id='P18sk'></ul>
                          主站蜘蛛池模板: 北京晚会活动策划|北京节目录制后期剪辑|北京演播厅出租租赁-北京龙视星光文化传媒有限公司 | 济南冷库安装-山东冷库设计|建造|冷库维修-山东齐雪制冷设备有限公司 | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 苏州注册公司_苏州代理记账_苏州工商注册_苏州代办公司-恒佳财税 | 东莞市超赞电子科技有限公司 全系列直插/贴片铝电解电容,电解电容,电容器 | 环比机械| 酒瓶_酒杯_玻璃瓶生产厂家_徐州明政玻璃制品有限公司 | 山东螺杆空压机,烟台空压机,烟台开山空压机-烟台开山机电设备有限公司 | HEYL硬度计量泵-荧光法在线溶解氧仪-净时测控技术(上海)有限公司 | 模具ERP_模具管理系统_模具mes_模具进度管理_东莞市精纬软件有限公司 | PE一体化污水处理设备_地埋式生活污水净化槽定制厂家-岩康塑业 | 国产液相色谱仪-超高效液相色谱仪厂家-上海伍丰科学仪器有限公司 | 冷镦机-多工位冷镦机-高速冷镦机厂家-温州金诺机械设备制造有限公司 | 衬塑设备,衬四氟设备,衬氟设备-淄博鲲鹏防腐设备有限公司 | 自动气象站_气象站监测设备_全自动气象站设备_雨量监测站-山东风途物联网 | 苏商学院官网 - 江苏地区唯一一家企业家自办的前瞻型、实操型商学院 | 辽宁资质代办_辽宁建筑资质办理_辽宁建筑资质延期升级_辽宁中杭资质代办 | 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 手表腕表维修保养鉴定售后服务中心网点 - 名表维修保养 | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 生物颗粒燃烧机-生物质燃烧机-热风炉-生物颗粒蒸汽发生器-丽水市久凯能源设备有限公司 | 中央空调温控器_风机盘管温控器_智能_液晶_三速开关面板-中央空调温控器厂家 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 焊接烟尘净化器__焊烟除尘设备_打磨工作台_喷漆废气治理设备 -催化燃烧设备 _天津路博蓝天环保科技有限公司 | 冷油器,取样冷却器,热力除氧器-连云港振辉机械设备有限公司 | 煤粉取样器-射油器-便携式等速飞灰取样器-连灵动 | 低气压试验箱_高低温低气压试验箱_低气压实验箱 |林频试验设备品牌 | 海水晶,海水素,海水晶价格-潍坊滨海经济开发区强隆海水晶厂 | 深圳市宏康仪器科技有限公司-模拟高空低压试验箱-高温防爆试验箱-温控短路试验箱【官网】 | 注塑机-压铸机-塑料注塑机-卧式注塑机-高速注塑机-单缸注塑机厂家-广东联升精密智能装备科技有限公司 | 铸铁平台,大理石平台专业生产厂家_河北-北重机械 | 亮点云建站-网站建设制作平台| 污水处理设备,一体化泵站,一体化净水设备-「梦之洁环保设备厂家」 | 涿州网站建设_网站设计_网站制作_做网站_固安良言多米网络公司 | 圆周直径尺-小孔内视镜-纤维研磨刷-东莞市高腾达精密工具 | 冷藏车厂家|冷藏车价格|小型冷藏车|散装饲料车厂家|程力专用汽车股份有限公司销售十二分公司 | 湖南自考_湖南自学考试网 | 南溪在线-南溪招聘找工作、找房子、找对象,南溪综合生活信息门户! | 河南包装袋厂家_河南真空袋批发价格_河南服装袋定制-恒源达包装制品 | 净化板-洁净板-净化板价格-净化板生产厂家-山东鸿星新材料科技股份有限公司 | 新密高铝耐火砖,轻质保温砖价格,浇注料厂家直销-郑州荣盛窑炉耐火材料有限公司 |