1

I am about to use jQuery UI to build a web based GUI for a hardware product. It is very important that this GUI is always accessible 24/7 and be compatible for years and years down the road. I am not a computer genius, so this may seem like a dumb question, but I am concerned with the fact that the code generated by jQuery UI points to .js files located on a webserver. For example:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

These two lines of code exist in my HTML HEAD tags. These files do not exist on my physical server, so what if these webservers were to go down? I believe that I would lose all functionality to my web GUI.

Would it make a difference if I were to copy and paste the code in these .js files and place them on my web server? That way the GUI's lifeline is in the hands of my own server.

Basically, I am asking if anyone knows how safe it is to use jQuery UI for a web based GUI that MUST not ever go down. I am missing something here and it would be very helpful if some one could explain to me in more detail how I could use jQuery UI in a safe and dependable way so that I am not depending on code that exists on another server. Thank you!

SORC_
  • 79
  • 2
  • 7
  • The most reliable solution would be to host the files locally. At that point it would be 100% safe and never change, as long as you never update it. – Kevin B Sep 03 '13 at 18:24

3 Answers3

3

You keep a copy of the files in your local system, and add fallback code as in this question or this question

<script>
if (!window.jQuery.ui) {
    document.write('<script src="/path/to/your/jquery"><\/script>');
}
</script>
Community
  • 1
  • 1
Ross
  • 3,022
  • 1
  • 17
  • 13
2

For many scenarios, the hosted jquery is fine.

But, for your situation, you should download jquery and jquery UI from the links on their sites and place the files in a folder on your webserver. Then change the script lines to point to the location on your server instead of the jquery.com site.

Geoff
  • 9,340
  • 7
  • 38
  • 48
  • So I will need to download the jQuery library AND the jQuery UI library? I will only be using jQuery UI elements such as the 'tab view' and 'accordion' widgets. Would it be necessary to have the entire jQuery library if I am only using jQuery UI widgets? – SORC_ Sep 03 '13 at 19:44
  • Yes, Jquery UI depends on jquery, so you need both. You don't have to get the entire library, the jquery ui download page lets you choose which elements to download. – Geoff Sep 04 '13 at 10:43
0

i would say go with hosted js file

//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

for

These files do not exist on my physical server, so what if these webservers were to go down?

firstly these server won't go down at all...

there are other various advantages to it too.. such as decreased latency, increased parallelism, better caching.

A CDN — short for Content Delivery Network — distributes your static content across servers in various, diverse physical locations. When a user’s browser resolves the URL for these files, their download will automatically target the closest available server in the network.

In the case of Google’s AJAX Libraries CDN, what this means is that any users not physically near your server will be able to download jQuery faster than if you force them to download it from your arbitrarily located server.

link to read more about it

even, stackoverflow uses the hosted js file.. checkout view page source :).

bipen
  • 36,319
  • 9
  • 49
  • 62
  • The servers may not go down, however your access to said servers may occasionally not work depending on the reliability of the network being used. – Kevin B Sep 03 '13 at 18:36