Rails and javascript cache -


I will start developing a new app that uses many JS libraries (prototype, script, tinimax etc.) ).

Someone asked me to make all the apps to use Ajax, so all JS files will be loaded only once.

My question is, should I do everything on AJAX?

We say that if I call myapp.com/projects and the projects use all those JS files, then I click the "Show" link and I'll redirect myapp to it on I'm redirecting to .com / projects / 1. Will all JS be reloaded?

No, your javascript files will not be reloaded, the client should be cached on.

But yes, your application must be checked by the server at every page's load, the server is often responding that the scripts have not changed. By using AJAX, you reduce the number of connections to the server. You can reduce the number of connections by collecting all the javascript files in one.

Note that AJAX will add some new issues, such that you can force memory leaks to track because your app will never unload your items if you never reload the new page

If you are not easily with Javascript, then I strongly recommend that the page be reloaded with the "old" model of reloading. If you have performance problems, then you can deal with them later.


Comments