如果我的网站链接到外部样式表,我应该担心[重复]

时间:2022-10-19 22:09:37

This question already has an answer here:

这个问题在这里已有答案:

At some point in my website I needed a Timer so I looked for a free jQuery Countdown Timer and found this one : Example

在我网站的某个时刻,我需要一个Timer,所以我找了一个免费的jQuery Countdown Timer,发现了这个:例子

After integrating the model to my page inside my IDE (VS2010) i payed attention that some CSS and JS files are not stored locally in my project folder, but they are still Linked to an External sources, and that had me thinking : Am i suppose to find a way to download these file locally than use them, or should i use them the way they are ? and should i be concerned if they may change or desperate at some point in the future ? what are the best practices in case ?

在我的IDE(VS2010)中将模型集成到我的页面后,我注意到一些CSS和JS文件没有存储在我的项目文件夹中,但它们仍然链接到外部源,这让我想:我想找到一种在本地下载这些文件而不是使用它们的方法,或者我应该按照它们的方式使用它们?如果他们将来可能会改变或绝望,我应该担心吗?有什么最好的做法?

Here is an example of the HTML code :

以下是HTML代码的示例:

....
....
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
    <script type="text/javascript" src="inc/TimeCircles.js"></script>
....
....

2 个解决方案

#1


1  

Those are CDNs ( http://it.wikipedia.org/wiki/Content_Delivery_Network ) meaning that they're hosted by someone for all of us to use, so you're pretty much guaranteed it will stay there. The main advantage of using CDNs is that the user will probably have visited another site that uses the same resource and this means that said resource is already cached in the user's computer, leading to a faster loading time for your site.

这些是CDN(http://it.wikipedia.org/wiki/Content_Delivery_Network),意味着它们由我们所有人使用的托管,所以你几乎可以保证它会留在那里。使用CDN的主要优点是用户可能访问过使用相同资源的另一个站点,这意味着所述资源已经缓存在用户的计算机中,从而加快了站点的加载时间。

#2


1  

You should never rely on external sources for critical files unless you're using a dependable CDN. In this case you're using the most common CDN sources for Bootstrap and jQuery, so you're all set.

除非您使用可靠的CDN,否则不应该依赖外部源来获取关键文件。在这种情况下,您正在使用Bootstrap和jQuery最常用的CDN源,因此您已经完成了所有设置。

I assume that you've downloaded the timer files and are hosting those locally. Your reference to them confused me, so I've updated this answer.

我假设您已经下载了计时器文件并在本地托管这些文件。你对他们的引用让我很困惑,所以我更新了这个答案。

#1


1  

Those are CDNs ( http://it.wikipedia.org/wiki/Content_Delivery_Network ) meaning that they're hosted by someone for all of us to use, so you're pretty much guaranteed it will stay there. The main advantage of using CDNs is that the user will probably have visited another site that uses the same resource and this means that said resource is already cached in the user's computer, leading to a faster loading time for your site.

这些是CDN(http://it.wikipedia.org/wiki/Content_Delivery_Network),意味着它们由我们所有人使用的托管,所以你几乎可以保证它会留在那里。使用CDN的主要优点是用户可能访问过使用相同资源的另一个站点,这意味着所述资源已经缓存在用户的计算机中,从而加快了站点的加载时间。

#2


1  

You should never rely on external sources for critical files unless you're using a dependable CDN. In this case you're using the most common CDN sources for Bootstrap and jQuery, so you're all set.

除非您使用可靠的CDN,否则不应该依赖外部源来获取关键文件。在这种情况下,您正在使用Bootstrap和jQuery最常用的CDN源,因此您已经完成了所有设置。

I assume that you've downloaded the timer files and are hosting those locally. Your reference to them confused me, so I've updated this answer.

我假设您已经下载了计时器文件并在本地托管这些文件。你对他们的引用让我很困惑,所以我更新了这个答案。