久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <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="qwawimqqmiuu" 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="qwawimqqmiuu" 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 瀏覽器中的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問題描述

                我有一個(gè)重要的腦筋急轉(zhuǎn)彎.

                我想用經(jīng)典的 ASP 打開一個(gè)文件.我正在使用各種變量,因?yàn)槭虑榭赡軙?huì)改變,但結(jié)果是正確的.我知道這一點(diǎn)是因?yàn)槲乙呀?jīng)通過復(fù)制鏈接地址并將其放在我的 URL 中來(lái)測(cè)試結(jié)果.現(xiàn)在的問題是:如果我點(diǎn)擊我的鏈接,它不會(huì)做任何事情.不是刷新,不是重定向.沒有什么.有誰(shuí)知道我做錯(cuò)了什么?

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

                我有 3 個(gè)環(huán)境.這里下面的變量是為了使鏈接有效.我知道該鏈接有效,因?yàn)槲乙呀?jīng)通過復(fù)制對(duì)其進(jìn)行了測(cè)試.是的,它確實(shí)以 file:/// 開頭,是的,我確定鏈接是正確的.

                這是我的代碼行:

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

                <小時(shí)>

                帶有錯(cuò)誤/鏈接結(jié)果的屏幕截圖

                解決方案

                現(xiàn)在我們知道實(shí)際的錯(cuò)誤是什么,可以制定答案了.

                <塊引用>

                不允許加載本地資源

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

                過去您可以覆蓋某些設(shè)置或應(yīng)用某些標(biāo)志,例如

                <上一頁(yè)>--disable-web-security --allow-file-access-from-files --allow-file-access

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

                <塊引用>

                它的存在是有原因的

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

                還有一種方法

                由于您已經(jīng)可以訪問 Classic ASP,因此您始終可以構(gòu)建一個(gè)為基于網(wǎng)絡(luò)的文件提供服務(wù)的中間頁(yè)面.您可以結(jié)合使用 ADODB.Stream 對(duì)象和 Response.BinaryWrite() 方法來(lái)執(zhí)行此操作.這樣做可確保您的網(wǎng)絡(luò)文件位置永遠(yuǎn)不會(huì)暴露給客戶端,并且由于腳本的靈活性,它可用于從多個(gè)位置和多種文件類型加載資源.

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

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

                這個(gè)例子是偽編碼的,因此未經(jīng)測(cè)試.

                然后可以像這樣在 <a> 中使用這個(gè)腳本來(lái)返回資源;

                <a href="/getfile.asp?id=TESTFILE1">點(diǎn)擊這里</a>

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


                有用的鏈接

                • 使用 METADATA 導(dǎo)入 DLL 常量 - 如果您無(wú)法識(shí)別 adTypeBinary,總是比硬編碼 1 更好.

                • Content-Disposition:inline"和attachment"有什么區(qū)別? - 有用信息關(guān)于 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.

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

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

                相關(guān)文檔推薦

                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中獲取響應(yīng) 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 錯(cuò)誤:跨源請(qǐng)求僅支持協(xié)議方案:http、data、chrome-extension、https) - IT屋-程序員軟件開發(fā)技術(shù)分
                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(從本地文件夾導(dǎo)入 type=module 的腳本會(huì)導(dǎo)致 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="qwawimqqmiuu" id='P18sk'><tfoot id='P18sk'></tfoot><dl id='P18sk'><fieldset id='P18sk'></fieldset></dl></div>

                          <bdo id='P18sk'></bdo><ul id='P18sk'></ul>
                          主站蜘蛛池模板: 日韩视频精品 | 国产一区在线视频 | 日韩在线视频一区二区三区 | 欧美日韩国产高清视频 | 91偷拍精品一区二区三区 | 成人在线视 | 99视频在线播放 | 国产农村妇女毛片精品久久麻豆 | 亚洲欧美中文日韩在线v日本 | 福利片在线观看 | 亚洲国产精品99久久久久久久久 | 午夜影院在线观看 | 久久这里只有精品首页 | 免费在线观看av网址 | 一区二区日韩 | 国产剧情一区 | 在线观看的av | 欧美一区免费 | 久久久久久综合 | 在线观看免费av网 | 精品国产乱码久久久久久88av | 天天干成人网 | 中文字幕在线视频观看 | 最新中文字幕在线播放 | 中文字幕欧美在线观看 | 中文字幕一区二区在线观看 | 久久免费高清视频 | 日本成人中文字幕在线观看 | 亚洲免费观看 | 日本成人在线观看网站 | av网站免费| 国产 亚洲 网红 主播 | 黑人精品欧美一区二区蜜桃 | 欧美日韩综合视频 | 综合色播 | 久久69精品久久久久久国产越南 | 亚洲免费在线视频 | 欧美久久久 | 人人性人人性碰国产 | 亚洲一区二区三区视频免费观看 | 日本激情视频在线播放 |