Reasons to Minimize JavaScript Use

JavaScript has many uses and has its place amongst frontend web development. However, it also has its many drawbacks when overused on a website. Many web developers want to have flashy, moving website for users to look at. But, what happens when the site is heavily relying on JavaScript?

Over use of JavaScript in layout modification can cause problems. If the JavaScript isn’t working or is turned off the page may appear broken, certain elements may no longer stay hidden, positioning may be lost, or the page may appear as a jumbled mess and no one stays to use it.

Or, worst of all, customers cannot buy from your website. JavaScript should not be used when regular page functionality is needed.

Relying on it too much can have very adverse effects on the site.

 

One reason is security.

 

Many things can be done on the frontend to modify pages. HTML injections, modifying form destinations, and the list goes on and on. Minimum amounts of JavaScript should be considered and only used when certain effects are desired and cannot be achieved by CSS.

Speed is another reason.

 

As the amount of JavaScript increases on the site, the page rendering may slow down. Every second counts. Just look at the infographic below, depicting how the number of seconds correlates to an increase in page abandonment. JavaScript adds time.

Picture 1

When laying out a page, especially in responsive design, think about how the page is going to transition and function.

If it has to rely on JavaScript to modify the layout, you run the risk of no one being able to use your site.

Elliott_Blog