Javascript 无法加载资源:net::ERR_FILE_NOT_FOUND 加载 json.js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32405812/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 08:00:38  来源:igfitidea点击:

Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js

javascriptjqueryhtmljson

提问by user2133925

I am testing an html webpage and it is failing to load a local jquery.json-2.4.0.js. I am testing the html page locally from chrome. When the page loaded I get a net::ERR_FILE_NOT_FOUND.

我正在测试一个 html 网页,但无法加载本地 jquery.json-2.4.0.js。我正在从 chrome 本地测试 html 页面。当页面加载时,我得到一个net::ERR_FILE_NOT_FOUND。

Why is it unable to load the file? This file has been moved from a different server (which it was working fine on), but the directory paths are the same (I double checked the path ).

为什么无法加载文件?该文件已从另一台服务器(它运行良好)移动,但目录路径相同(我仔细检查了路径)。

Here is my line:

这是我的线路:

<script type='text/javascript' src='/webforms/ExperianEmailJsScripts/jquery/js/jquery.jsonp-2.4.0.js'></script>

采纳答案by ezpn

This error means that file was not found. Either path is wrong or file is not present where you want it to be. Try to access it by entering source address in your browser to check if it really is there. Browse the directories on server to ensure the path is correct. You may even copy and paste the relative path to be certain it is alright.

此错误表示未找到文件。路径错误或文件不在您想要的位置。尝试通过在浏览器中输入源地址来访问它,以检查它是否真的存在。浏览服务器上的目录以确保路径正确。您甚至可以复制并粘贴相对路径以确保它没问题。

回答by Zak

Remove the first /in the path. Also you don't need type="text/javascript"anymore in HTML5.

删除/路径中的第一个。你也不再需要type="text/javascript"HTML5 了。

回答by Thiago Farias

I got the same error using:

我使用以下方法遇到了同样的错误:

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">

But once I added https:in the beginning of the href the error disappeared.

但是一旦我在 href 的开头添加了https:错误就消失了。

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i,900,900i" type="text/css" media="all">

回答by Andrew Zoka

Same thing happened to me. Eventually my solution was to navigate to the repository using terminal (on mac) and create a new js file with a slightly different name. It linked immediately so i copied contents of original file to new one. You also might want to lose the first /after src=and use "".

同样的事情发生在我身上。最终我的解决方案是使用终端(在 mac 上)导航到存储库并创建一个名称略有不同的新 js 文件。它立即链接,所以我将原始文件的内容复制到新文件中。您可能还想丢失第一个/aftersrc=并使用"".