Dynamically linking to ajax.googleapis jquery

Hi
I am using jquery and jqueryui in my application And in layout I use

<%= javascript_include_tag
http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js”%>
<%= javascript_include_tag
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js” %>
<%= stylesheet_link_tag
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css
%>

    My question is, there any problem by linking to css and js like

these. I am totally a newbie regarding this? Is this a performance issue
in production. And I have one more concern(Dont know I am right) suppose
if in any case those sights down then will it fail? What is the normal
procedure for doing this? Whether I have to download all the sources to
my application?

Thanks for your time
Tom

“Tom M.” [email protected] wrote in message
news:[email protected]

   My question is, there any problem by linking to css and js like

these. I am totally a newbie regarding this? Is this a performance issue
in production. And I have one more concern(Dont know I am right) suppose
if in any case those sights down then will it fail? What is the normal
procedure for doing this? Whether I have to download all the sources to
my application?

If Google is down (yes, it does happen on rare occasion!) the javascript
files will fail to load. Any code that tries to use jquery would fail.
In
the best case, all remaining code will continue to work, and thus only
some
small part of the site will be broken. In the worst case, the browser
will
give up on running javascript for the page, and the page wil continue to
work like javascript was not enabled. If your site is designed well it
will
work even when javascript is not enabled, but some non-essential fancy
AJAX’y stuff might not work.

It is pretty easy to test out what would happen if they fail to load
simply
by changing the “/ajax/” part of each url to “/noajax/”, which of course
does not exist and will cause the downloads to fail. Just be sure to
change
them back when done testing.

As for performance, remote loading from Google may sometimes be faster
or
other times slower than storing the file on the server. You can get more
consistant perforance by putting the files on your server, but more
consistant might not be better.

Many people err on the side of caution and choose to keep local copies
of
jquery.min.js, jquery-ui.min.js and jquery-ui.css on their servers. If
in
doubt, I’d suggest that. It is easy to download the files and place them
in
public/javascripts and public/stylesheets.

Hi Joe

Thanks for your elaborate answer. It was useful

Tom

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