Download & Extend

Configuring jQuery Update to use jQuery via Google CDN

Project:jQuery Update
Version:6.x-2.x-dev
Component:Miscellaneous
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

hi,

i've installed jquery_update w/ drupal v6.13,

version = "6.x-2.x-dev"
core = "6.x"
project = "jquery_update"
datestamp = "1240532053"

iiuc, the module packages a local instance of jquery.

(1) google's now making ajax libs avaiable via its cdn (http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery)

can jquery_update be _configured_ to use a remote instance of the libs? if so, i've missed the config ...

(2) the README.txt says,

"3. Visit Administer > Site Configuration > jQuery Update to configure the module."

i've verified that the module *is* activated, but there's no such menu option @ "Site Configuration". any hints?

thanks!

Comments

#1

2 things....

First, be aware that not everyone has access to the js in the google cdn. There are some countries (like Iran) that block it.

Second, Drupal 6 core doesn't support external JavaScripts. It may be possible to support this with a hack of sorts.

This can go on the mid term todo list. But, before you pursue this re-read the first point and consider what your site will be like when js breaks for people in those countries.

#2

hi,

> be aware that not everyone has access to the js in the google cdn.

understood.

> Second, Drupal 6 core doesn't support external JavaScripts. It may be possible to support this with a hack of sorts.

i did not realize that ... i note that . e,g, yui-editor module allows use of external js ... does it not touch core as well?

> This can go on the mid term todo list.

thanks!

#3

drupal_add_js(), which is the function a module should use to add a reference to a JavaScript file into the page, doesn't allow to use a reference to a file that is not on the local server that is running Drupal.

#4

I too need this - the biggest reason is that the jQuery folks themselves request this, so that it will be more likely to be cached from other sites and thus speed up the user's browsing experience, rather than re-downloading multiple jquery.js files from various websites that all have the same source. It's becoming one of the most heavily used libraries out there, especially given its inclusion in many CMSes, so this seems like a great idea...

Any ideas?

#5

This would be a great addition.

#6

One thought - due to Drupal's aggregation if cache is enabled, this would need to be outside of that to do any good (ie: to allow it to be cached on the client across sites)

#7

Status:active» needs review

The attached patch to 6.x-2.x-dev accomplishes the following:

  • provides an additional option to use "Google CDN (External, Minified, Compressed)"
  • updates to supporting functions to handle the new options
  • adds a script tag for http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js - does not add this using drupal_add_js
    • added before any other scripts
    • it is not included in aggregation

Is it a little hacky? Yes.. but it works as expected and takes the load off of your server using a free CDN.
Comment if anyone has a better way of accomplishing this.

AttachmentSize
jquery_update_GoogleCDN_525436.patch 3.21 KB

#8

subscribe

#9

Status:needs review» closed (duplicate)

dup of #263459: Use Google's Javascript CDN for jQuery

#10

This patch worked for me. Thanks, yang_yi_cn :)

(I know, a year later, but still... :)

#11

Title:configuring jquery_update to use jquery via Google CDN?» Configuring jQuery Update to use jQuery via Google CDN
Category:support request» task

#12

If someone is looking for this right now; wait another 9 hours for d.o to package up the first dev of the Advanced CSS/JS Aggregation module where serving jquery.js from the google cdn is one of the sub modules that can be installed.