Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relying on JavaScript

I've been tasked with creating an extremely heavy JavaScript site that of course must be backwards compatible as well as work on pad devices, dynamically resize, etc...

Does anyone have advice on how to help with the reliability of the code? Currently, a lot happens when the DOM is ready. E.g. graphics are scaled, click events are defined, etc...

However, if a file is slow or the user stops the load, the DOM ready doesn't always execute causing the images to not resize properly or some other Javascript function to execute.

Most times everything works flawlessly, but there are those odd times with network connectivity that cause a few "random" issues.

Would love to hear some thoughts on improving the reliability.

like image 230
endyourif Avatar asked Jan 23 '12 15:01

endyourif


Video Answer


1 Answers

Load all your content via JavaScript.

This way you can make sure all of the libraries needed are loaded before the application is displayed. You can also use a nice loading screen if it isn't a quick download, and can possibly detect loading issues. Of course, this is only for web applications that absolutely must use JavaScript.

like image 144
Levi Morrison Avatar answered Sep 25 '22 07:09

Levi Morrison