我总是怀疑。我认为谷歌是聪明的。 但是,当我复制jQuery的链接,有开发者网站 https://developers.google.com/speed/libraries/devguide以下jQuery的链接为什么Google Developer Library的jQuery链接中没有协议?
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
示例代码
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
alert('hello');
});
</script>
</head>
<body>
</body>
</html>
它不适合我
工作,但是当我改变它
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
alert('hello');
});
</script>
</head>
<body>
</body>
</html>
它为我工作
中的链接为什么Google不要附加http:
?这是故意的吗?
我使用Mozilla浏览器作为
你在第一行加上'://' –
这个错字不是这样,当我错误地提出这个问题时 – sanjeev
因为你打开(*最有可能*)文件从你的磁盘,而不是通过服务器查看它。所以你的协议是'file://',它不能与这个代码无效。 –