What is the disadvantage of using too much JavaScript?

I would like to know what are some of the disadvantages of using too much JavaScript code in a web page?

For example, I will use the jQuery structure for drop-down menus, tabs, and the accordion. And other JavaScripts for my calendar (even if there is an available calendar that uses jQuery) and other JavaScript for other things? What is the effect? (My opinion contradicts JavaScript and loads hard)

I know many developers who own more than 2 JavaScript frameworks. My question is: when developing a project, how do you choose the JavaScript structure for this project? Why are you using MooTools or jQuery for this project? (I know this is a matter of choice), but is there any other reason? How mootools is good for this ... or jQuery is good for this.

I want to hear your opinion.

+6
javascript jquery prototypejs mootools javascript-framework
source share
10 answers

What are some disadvantages of using many Java scripts on a website?

  • HTTP overhead
  • Low maintainability

Why are you using MooTools or jQuery for this project?

This is not just a matter of personal taste. this question for more details.

There are certain frameworks for specific things - take Ext JS , for example, which tries to cover everything a site needs. This is not what jQuery does.

+9
source share

This will depend on the browser (and the back) and how it executes / scales many scripts. When developing a solution, first think about the requirements of the audience. Will quad monsters be launched on ultrafast fiber optic lines or small phones with GPRS channels. Then determine which technologies will fill these needs.

Do not start over with technology.

+6
source share

From your question you come up with several questions:

  • Having a large number of small script files can be a performance issue. If you intend to use many different scripts, merge them into a single script file (and reduce it and serve it using gzip compression). There's a tip related to this on an unofficial prototype and script.aculo.us wiki (disclosure: I basically wrote this advice, but with a lot of input from smart people). Also see if you can use CDN (most frameworks are now available via Google CDN , for example).
  • The presence of many different frameworks (jQuery, Prototype, MooTools, YUI, etc.) on the same site can become a skill problem - anyone who works on this site must have skills in various different frameworks.
  • Some frameworks are incompatible with each other (for example, I doubt that the prototype and MooTools can coexist on the same page, jQuery and Prototype can work through jquery mode without conflicts).

From the point of view of choosing a single structure, look at what you are trying to do - some structures are better suited for some sites than others. Also look at the skills your developers already have, because the less new things they need to learn, the more time they can spend on building their site. Look at the community around the frame. Think about the availability of plugins (although there are many low-quality plugins out there, do not judge by quantity). See if the API works well with your approach to things.

+2
source share

I would say that there are several possible drawbacks to using multiple libraries:

  • Initial download time: you need to be careful about the size of your files. For example, if this calendar you are using whole separate libraries, you should be asking why you are not just using the jQuery version.
  • Client performance: you are unloading a large number of client computers and older machines / browsers will be a particularly intense scenario. It is a matter of knowing your target audience, though - if you are targeting techies with a PC monster then you are likely to leave with difficult scenarios.
  • Conflicts: as you say, there may be conflicts between functions in different libraries. There are ways around this, but why give yourself the problem in the first place?

After all, all of these libraries are just another way of writing JavaScript. Choose which library works for you; one that allows you to do the job faster and with the least errors.

+2
source share

Network overhead. I'm not talking about the scripts themselves, but about what they do:

Many plugins create frames for downloading content from third-party sites: Facebook, such as buttons, comments, twitter, Google and various types of advertising, etc. And besides, these plugins can load and run their own script tools.

Even if you have 8 cores, the content of the website jumps for at least 30 seconds, as plugins load their content (on every page visit!). This is why I installed browser plugins to block javascript forever. But even if I allow them to distribute the fact that they pull scripts from at least 20-30 domains, and I need to include all the scripts on the page 4-5 times to make the site fully functional. Please avoid creating such situations.

+2
source share

The answer is pretty obvious: more JavaScript means more workload. Depending on how you structured your files, this may mean more HTTP requests, more data to download, more code to parse, etc. If this is impossible to avoid at all, you should choose a good structure (e.g. jQuery) and stick to it, and not mix and match them.

Performance aside, several frameworks also mean less supported code, because maintainers must be familiar with each structure in order to be able to work with them.

There are probably some exceptions, such as using a general framework like jQuery with a more specific one like Raphael, but this is usually solved with plugins.

0
source share

One aspect is that it may take time to download. If you have your scripts in included or linked files, it takes loading time and more HTTP requests.

In addition, more scripts can slow down the client computer. Many users now have several pages or tabs at once, and if yours is so heavy and slow that opening other pages at the same time makes things unstable on a basic computer, then your site is probably a bit excessive.

And finally, what if the user does not have javascript or it is disabled? Will it completely break your site?

0
source share

Do not forget that some users can disable Javascript, so the presence of some necessary website functions (for example, menus, navigation, forms, etc.) JS-based will cause these users to not be able to view your site.

0
source share

Using a large number of JavaScript files should not be a problem, as you can always combine them all together to minimize HTTP requests. Of course, it takes browser time to execute all this JavaScript. There is also a chance that there will be conflicts between all of these JS libraries / plugins or inside the DOM.

As for choosing the right library, it really depends on what type of site / application you are making. If you just want to use ready-made plugins, then there is not much difference in which library you use, and you should just choose the one that has more plugins that you want to use, and I am absolutely sure that jQuery is the best choice here, so as it has most plugins in general.

On the other hand, if you want to write your own components / plugins / code, you should check each of them and see which one suits your coding style and design in the best way. For example, some time ago I discovered that Prototype is better suited to my taste and quite good for large JS projects. But since then, jQuery has come a long way, so I will probably try each of the most popular libraries if I had to create a new project.

0
source share
  • Consider a situation in which 99% of your target consumer does not support javascript in their browser, and you write heavy javascript code on your website.
  • Also, javascript runs on the client machine with a very low priority, which can slow down your site.

And one more

  • All your javascript codes are made available as javascript is an interpreted language.
-one
source share

All Articles