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

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

      • <bdo id='bTrzn'></bdo><ul id='bTrzn'></ul>
      <legend id='bTrzn'><style id='bTrzn'><dir id='bTrzn'><q id='bTrzn'></q></dir></style></legend>
    1. <small id='bTrzn'></small><noframes id='bTrzn'>

      從 GitHub 讀取代碼作為網頁中的文本(原始)

      Reading code from GitHub as text (raw) in a web page(從 GitHub 讀取代碼作為網頁中的文本(原始))
      • <tfoot id='n5fS5'></tfoot>

            <bdo id='n5fS5'></bdo><ul id='n5fS5'></ul>

            <legend id='n5fS5'><style id='n5fS5'><dir id='n5fS5'><q id='n5fS5'></q></dir></style></legend>

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

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

                <tbody id='n5fS5'></tbody>

              • 本文介紹了從 GitHub 讀取代碼作為網頁中的文本(原始)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試從我的 GitHub 存儲庫中讀取一些源代碼(C 語言),以便在我的網頁中顯示為文本.我可以通過 https://raw.github.com 以原始模式訪問代碼.

                I'm trying to read some source code (C language) from my GitHub repository to be shown as text in my webpage. I can access the code in raw mode through https://raw.github.com.

                我正在使用 jQuery GET 函數來讀取數據,但它不起作用.問題與 XMLHttpRequest 和 Access-Control-Allow-Origin 有關,但是盡管我在 stackoverflow 上發現了一些相關問題(XmlHttpRequest 錯誤:Access-Control-Allow-Origin 不允許使用 Origin null)它對我不起作用.我什么都試過了.

                I'm using jQuery GET function to read the data but it doesn't work. Problem is related with XMLHttpRequest and Access-Control-Allow-Origin but, despite I found some related question on stackoverflow (XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin) it didn't work for me. I tried everything.

                我的 jQuery 代碼:

                My jQuery code:

                <script type="text/javascript">
                  $(document).ready(function() {
                    var url = 'https://raw.github.com/raysan5/raylib/master/examples/ex01_basic_window.c';
                
                    $.get(url, function(data) { 
                        $('#code').text(data);
                      }, 'text');
                    });
                </script>
                

                請問,有人可以幫我解決這個問題嗎?非常感謝!

                Please, could someone help me with this issue? Many thanks!

                推薦答案

                你可以嘗試刪除raw和github之間的點:

                You could try and delete the dot between raw and github:

                https://rawgithub.com/raysan5/raylib/master/examples/ex01_basic_window.c
                

                參見 rawgithub.com,在這個 博文:

                GitHub 不鼓勵這樣做,因為他們希望 repo 所有者使用 Github Pages 來托管其文件的特定版本.他們通過使用 Content-Type: text/plain 而不是 Content-type:application/javascript 提供來自raw"域的文件來阻止它.

                GitHub discourages this, since they want repo owners to use Github Pages to host specific versions of their files. They discourage it by serving files from the "raw" domain with Content-Type: text/plain instead of Content-type:application/javascript.

                直到最近,當 Google Chrome 實施了一個安全修復程序,如果 JavaScript 的 Content-type 不正確,這將阻止 JavaScript 被執行,這才成為問題.
                當您查看您無法控制的頁面時,這是有道理的.但是,當您決定要包含哪些腳本時,就很麻煩了.

                This wasn’t a problem until recently, when Google Chrome implemented a security fix that prevents JavaScript from being executed if it has an incorrect Content-type.
                This makes sense when you’re viewing pages outside of your control. But when it’s you who’s deciding what scripts to include, it’s a hassle.

                作為 Rob W 以下評論:

                值得一提的是,此網絡服務解決 OP 問題的唯一原因是它包含 Access-Control-Allow-Origin: * 響應標頭.

                It's worth mentioning that the only reason that this web service solves the OP's problem is that it includes the Access-Control-Allow-Origin: * response header.

                這篇關于從 GitHub 讀取代碼作為網頁中的文本(原始)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                  <tbody id='sVxNw'></tbody>
                <i id='sVxNw'><tr id='sVxNw'><dt id='sVxNw'><q id='sVxNw'><span id='sVxNw'><b id='sVxNw'><form id='sVxNw'><ins id='sVxNw'></ins><ul id='sVxNw'></ul><sub id='sVxNw'></sub></form><legend id='sVxNw'></legend><bdo id='sVxNw'><pre id='sVxNw'><center id='sVxNw'></center></pre></bdo></b><th id='sVxNw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sVxNw'><tfoot id='sVxNw'></tfoot><dl id='sVxNw'><fieldset id='sVxNw'></fieldset></dl></div>
                • <bdo id='sVxNw'></bdo><ul id='sVxNw'></ul>

                  • <small id='sVxNw'></small><noframes id='sVxNw'>

                    <legend id='sVxNw'><style id='sVxNw'><dir id='sVxNw'><q id='sVxNw'></q></dir></style></legend>

                        1. <tfoot id='sVxNw'></tfoot>
                          主站蜘蛛池模板: 国产精品99久久久久久动医院 | 精品一区二区在线视频 | 综合激情网 | 欧美自拍另类 | 中文字幕日韩在线 | 欧美日韩一 | 亚洲精品乱码8久久久久久日本 | 中文字幕视频在线 | 黄色小视频入口 | 97精品一区二区 | 欧美国产一区二区 | 国产精品一区二区三区在线 | 国产一区免费 | 中文字字幕一区二区三区四区五区 | 国产日韩一区二区 | 欧美精品在线免费观看 | 欧美一二区| 亚洲视频一区二区三区四区 | 日韩精品视频在线 | 在线视频一区二区 | 一级毛片网 | 欧美一级高潮片免费的 | 久久久www成人免费精品 | aaa国产大片 | 91久久北条麻妃一区二区三区 | www亚洲免费国内精品 | 成人网在线 | 亚洲欧美日韩国产综合 | 免费不卡一区 | 精品欧美一区二区三区久久久 | 亚洲先锋影音 | 在线观看中文字幕 | 美国一级黄色片 | 精品亚洲永久免费精品 | 免费精品久久久久久中文字幕 | 97伦理电影网 | 亚洲经典一区 | 日韩精品免费一区二区在线观看 | 中文字幕一区在线观看视频 | 欧美成人a∨高清免费观看 老司机午夜性大片 | 国产成人精品一区二区 |