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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi, One solution is to put the <%= javascript_include_tag :application -%> before </html> 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 :> > 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. > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/-Js9dbZ5kN4J. For more options, visit https://groups.google.com/groups/opt_out.
Hi Geoffrey, I am going to try it out and see whether or not Google considers this as being deferred. Kind regards, Nick -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.