Rails 3 - how to defer parsing of JavaScript

I am trying to optimize my website and one of the suggestions I got was
to defer parsing of JavaScript. I have googled it for a couple of hours
but I haven’t come across an elegant solution to do this in Rails 3. I
am using the standard

<%= javascript_include_tag :application -%>

tag in my code, just before the closing head tag. Does anybody know a
relatively simple way to defer the loading of all the Javascript of the
application.js file? Thanks.

Hi,

One solution is to put the <%= javascript_include_tag :application -%>
before tag at the end of your layout file. So, the browser will
read the HTML code and after, make request to retrieve the javascript
files. Generally, this will boost your loading page when you have big
javascript files.

Le lundi 15 octobre 2012 14:41:14 UTC+2, Ruby-Forum.com User a crit :

Hi Geoffrey,

I am going to try it out and see whether or not Google considers this as
being deferred.

Kind regards,

Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs