It is a good approach to always use CDN but sometimes what if the CDN is down (rare possibility though) but you never know in this world as anything can happen.
Below given jQuery code checks whether jQuery is loaded from Google CDN or not, if not then it references the jQuery.js file from your folder.
if (typeof jQuery == ‘undefined’)
It first loads the jQuery from Google CDN and then check the jQuery object. If jQuery is not loaded successfully then it will references the jQuery.js file from hard drive location. In this example, the jQuery.js is loaded from Scripts folder.
Below is the code to load jQuery from all 3 CDNs.
Code to load jQuery Framework from Google CDN
Code to load jQuery Framework from Microsoft CDN
Code to load jQuery Framework from jQuery Site(EdgeCast CDN)
There are 3 popular jQuery CDNs.
Advantage of using CDN.
- It reduces the load from your server.
- It saves bandwidth. jQuery framework will load faster from these CDN.
- The most important benefit is it will be cached, if the user has visited any site which is using jQuery framework from any of these CDN
A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.
jQuery library comes in 2 different versions.
The development version is quite useful at development time as jQuery is open source and if you want to change something then you can make those changes in development version. But the deployment version is minified version or compressed version so it is impossible to make changes in it. Because it is compressed, so its size is very less than the production version which affects the page load time.
jQuery library comes in 2 different versions Development and Production/Deployment. The deployment version is also known as minified version. So .min.js is basically the minified version of jQuery library file. Both the files are same as far as functionality is concerned. but .min.js is quite small in size so it loads quickly and saves bandwidth.
As other client side libraries like MooTools, Prototype can be used with jQuery and they also use $() as their global function and to define variables. This situation creates conflict as
$() is used by jQuery and other library as their global function. To overcome from such situations, jQuery has introduced
Dollar Sign is nothing but it’s an alias for JQuery.
Over here $ sign can be replaced with “jQuery” keyword.
The starting point of jQuery code execution is $(document).ready() function which is executed when DOM is loaded.
Overloading in oop is same as overloading in real word. In real word overloading means assigning extra work to same machine or person. In oop method overloading is same. By process of method overloading you are asking your method to some extra work. Or in some cases we can say some different work also.
Normally method overloading in oop is managed on the basis of the argument passed in function. We can achieve overloading in oop by providing different argument in same function.
Overriding in php is very easy. As we know that overriding is process of modifying the inherited method. So in case of inheritance you only need to create method with same name in your child class which you want to override.