javascript jquery.min.js 加载资源失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15343070/
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-10-27 00:28:01  来源:igfitidea点击:

jquery.min.js Failed to load resource

javascriptdebugging

提问by Rafa? Developer

Why this link doesn`t work?

为什么这个链接不起作用?

//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="Description" content=" [wstaw tu opis strony] ">
    <meta name="Keywords" content=" [wstaw tu slowa kluczowe] ">
    <meta name="Author" content=" [dane autora] ">
    <title>[tytu? strony] </title>
    <link rel="stylesheet" href="style.css" type="text/css">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".animat_kon").click(function () {
                $(".animat_text").slideToggle("slow");
            });
        });
    </script>
</head>

error example: enter image description here

错误示例: 在此处输入图片说明

回答by PSR

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

you did not included http://

你没有包括 http://

whenever you are downloading from the server directly then usehttp://

每当您直接从服务器下载时,请使用http://

回答by powtac

Change

改变

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

into

进入

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

You missed the http:. You can skip the http:to let your browser automatically choose between HTTPS and HTTP. But in your case the debugging tool seems not to understand this syntax.

你错过了http:。您可以跳过http:让浏览器自动在 HTTPS 和 HTTP 之间进行选择。但是在您的情况下,调试工具似乎不理解此语法。

Find more information here: Can I change all my http:// links to just //?

在此处查找更多信息:我可以将所有 http:// 链接更改为仅 // 吗?

回答by tomsv

The link must start with http://

链接必须以 http://

回答by Gideon Babu

Please change your script src to:

请将您的脚本 src 更改为:

    <link rel="stylesheet" href="style.css" type="text/css"> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">

script src should start with http://

脚本 src 应该以 http://