Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if i don't use jquery CDN slim package of bootstrap v4

What happens if I don't use jQuery slim package that comes with Bootstrap v4 and instead of that I use the jQuery host CDN available on Jquery site. I google it and I know there is a difference between these two as the slim version does not have various functions like ajax or animations. Does it effect anything on my website if I remove the slim jQuery package that comes with Bootstrap v4.

I am just a beginner not a pro like others but I want to add some features on a page with Ajax. I spent hours online and try many codes but nothing works. In last I delete one by one script of Bootstrap than I found there is something with jQuery CDN link. When I used google host jQuery CDN the code works but not with the slim Bootstrap jQuery.

Does it effect anything on my website if I remove the slim jQuery package that comes with Bootstrap v4?

like image 737
rayvic Avatar asked Jan 04 '23 06:01

rayvic


1 Answers

So long as you have an up-to-date version of jQuery, then nothing will be affected from the point of view of bootstrap. The slim version that Bootstrap comes with simply provides functionality for the various features of Bootstrap that rely on jQuery to work properly like collapsible navbars, alerts, etc.

You can absolutely use a separate jQuery, and honestly probably should. jQuery is a fantastic library that was designed to make JS cross-browser compatible and making use of it drastically improves your code.

Also, I would recommend not using a CDN if possible. CDNs are great for speedy development but if your website is going to go into production and be used for any length of time, it's better to have dependencies like Bootstrap and jQuery locally hosted because CDNs can and will go down for any number of reasons (server shutdown, server migration, DDoS, perhaps the person accessing your website's internet access is limited and won't allow them to make GET requests to that CDN, etc.) and if any of those reasons occur, you won't be alerted. Your website will just break.

Edit: So I do want to make an update. Nowadays it seems like using a CDN in production has become more common thanks to the reliability of CDNs and the benefits of global CDN networks having nodes (likely) closer to your customer being comparatively quicker to serve the content than requests against your webserver.

like image 104
Pedro Avatar answered Jan 05 '23 21:01

Pedro