Bottom Line: These are the version of jQuery you can use in a Google Sites HTML box as of 20140808 (list at the bottom).

As I’ve recently mentioned, I’m starting to learn some JavaScript. One of my current projects is hosted on Google Sites, since it’s free and offers a relatively user friendly GUI for collaboration with people less inclined to work directly with HTML / CSS / etc. It is going okay, but Google Sites certainly has caused me some frustration with its limitations.

For example, I’m learning to use jQuery. In Google Sites, Google lets you put (some) JavaScript into an HTML Box that you can easily place on a page (Insert -> HTML Box). They helpfully explicitly allow jQuery:

You can link script tags to jQuery (For example, https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js). Versions 1.6 and newer are supported.

“Great!” I thought. I used jsfiddle to write up a little jQuery .hover() function for my first ever mouseover effect. Not knowing any jQuery, I figured I’d start with a pretty recent version. You can see my jsfiddle here, but it’s something to the effect of:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js'></script>
<div id='jquery_mouseover'>
    <p>Watch me change!</p>
</div>
<script>
var oldText = $('#jquery_mouseover').text();

$('#jquery_mouseover').hover(

function () {
    $(this).text('Wow, I changed!');
}, function () {
    $(this).text(oldText);
});
</script>

It worked pretty well, so I threw it in the HTML Box in Google Sites… and got an error: failed to load external url jquery.min.js, highlighting my src= link to Google’s own hosted jQuery 2.1.0. I saved the HTML Box anyway, and (of course) my little script didn’t work.

I went back to Google’s own link about jQuery, and noted that they explicitly list versions:

2.1.1, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.11.1, 1.11.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3

Weird. So 2.1.0 didn’t work, even though it’s on the list. So I went back and tried 2.1.1 by changing the relevant line to <script src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>. No luck, still with the same error in the HTML Box. Same with 2.0.3.

However, with 2.0.2… eureka! The yellow error message went away. Surely I was on the right track. Nope.

For some reason, it looks like it’s going to work, but the script itself just doesn’t work. Some errors appear in the console about Uncaught script error: Cannot define numeric properties. What a pain.

Next, I figured I should check the links Google was providing to ensure they were all working. I wrote a quick Bash script so I could copy and paste in the version numbers, and it would echo the http response code.

for num in 2.1.1, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.11.1, 1.11.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3; do echo $num | tr -d ',' | (read clean; echo "$clean: "$(curl -s -o /dev/null -w "%{http_code}" http://ajax.googleapis.com/ajax/libs/jquery/$clean/jquery.min.js)); done

It gave me 200 for all of them, so the links seem to be working.

Next I decided to just see if I could try to import each different version of jQuery and print out the version number. It took a bit of regex fun in TextWrangler, but it worked. The code ended up being a bit long, so I’m not going to embed it, but you can see it here. You should be able to C&P it into a Google Sites HTML Box, and it will print out the versions of jQuery that are working. You’ll likely get some duplicates… to be honest, I’m not sure why that is.

Anyway, here is the output I got,

Versions of jQuery that are working in Google Sites HTML Box as of Fri Aug 08 2014 12:55:21 GMT-0600 (MDT)

  • 1.10.1
  • 1.9.0
  • 1.8.3
  • 1.8.2
  • 1.8.1
  • 1.8.0
  • 1.7.2
  • 1.7.1
  • 1.7
  • 1.6.4
  • 1.6.3
  • 1.6.2
  • 1.6.1
  • 1.6

Sure enough, I changed my original jQuery src= to 1.10.1 and it worked just fine. Anyway, since I didn’t have much luck finding this info on StackOverflow or a few quick Google searches, I figured I’d post it and perhaps save someone out there the trouble.