admin管理员组文章数量:1277900
So the title says it. Is it bad practice to use <script src=".min.js" type="text/javascript"></script>
when I want to include Jquery in my page?
I asked this question because nowhere in the Jquery, Google, and Microsoft websites they provide such a link. Rather they put versioned links like this <script src="//ajax.googleapis/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
. That's why I thought maybe they do not want people to use that link.
And if it is bad practice, why is that? and what is the solution to keep up with these version changes?
So the title says it. Is it bad practice to use <script src="http://code.jquery./jquery-latest.min.js" type="text/javascript"></script>
when I want to include Jquery in my page?
I asked this question because nowhere in the Jquery, Google, and Microsoft websites they provide such a link. Rather they put versioned links like this <script src="//ajax.googleapis./ajax/libs/jquery/1.10.2/jquery.min.js"></script>
. That's why I thought maybe they do not want people to use that link.
And if it is bad practice, why is that? and what is the solution to keep up with these version changes?
Share Improve this question edited Dec 5, 2013 at 0:02 georg 215k56 gold badges322 silver badges399 bronze badges asked Dec 4, 2013 at 23:23 RezaReza 2,0683 gold badges20 silver badges33 bronze badges 04 Answers
Reset to default 9Using a "latest" jQuery in a production environment wouldn't be very smart, as your web site would stop working if breaking changes occur. You always want to know which jQuery version you are writing your web site's code against.
Updating to a new jQuery version should always be a manual process for that reason. It would ideally look something like this:
- Look at the change log or upgrade guide of the new version (example)
- Fix any issues in your code that the new version might cause
- Start using the new version on an internal / development version of the web site
- Test it thoroughly
- When all is well, switch the production site to using the new version.
A good option is use the official jquery.min.js version 3.6.0
<script src="https://jquery-min./ajax/libs/jquery/3.6.0/jquery.min.js" type="text/javascript"></script>
It's not necessarily bad practice, but using the Google API version is remended. The reason being is that many people visiting your sites will already have a cached version of the Google jquery, making your site load faster. Plus, there is a very very slim chance google will go down.
I believe it is bad practice because occasionally there are breaking releases, which you wouldn't find out about until it is too late.
As far as updating Jquery, I wouldn't suggest updating it until you needed a newer version specifically for a feature or bugfix.
本文标签: javascriptIs using quotjquerylatestminjsquot bad practiceStack Overflow
版权声明:本文标题:javascript - Is using "jquery-latest.min.js" bad practice? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741231273a2362152.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论