Why so many sites depend on JavaScript from external domains?
However, many sites that don't work without Javascript, include scripts from other domains belonging to Google, Facebook and plethora of advertisement platforms. All of them are known for tracking and profiling users in order to exploit their data for monetary reasons.
My question is that what are the technical justifications of loading a script from external server?
I can see more cons than pros:
+ browser can cache the file and when multiple sites use the same file, the experience will be faster as there is no reason to download the file more than once, + it is easier to copy-paste the URL of the dependency rather than download and host it yourself.
- when the external service goes down, so does your site, - external services can and will track your visitors, - as a developer, you cannot view your own site in local machine when offline - the external domains may be blocked by your ISP or country - people with NoScript plugin have to review every domain you download your script from to see if it can be trusted ;)