Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GS 3.1 and jQuery
#1
Hello,

Sorry I don't spend as much time here as I would like.

I have just had a look at v3.1B (r635) and I see that there is now a dependency on googleapis.com for jquery in the admin backend.

Is there any reason why this is loaded from Google, rather than from the website server? I understand the (theoretical) advantages of using Google to serve such libraries, but this is my problem:

I normally use NoScript on Firefox to disable javascript by source URL. This means that I can be selective about what scripts are running in my browser. (This is as much a speed/performance thing as a privacy concern.)

To use essential functionality in GS 3.1 admin, I now have to enable javascript from googleapis.com, which opens up a whole raft of other scripts and web functions that get in my way – translations, fonts, visual effects, for example – and that I really don't want to have.

I can provide my own local solution for this, but thought that a bit of feedback might be of interest. Is there a particular reason for using jQuery from this source?


Thanks.
--
Nick.
Reply
#2
hameau Wrote:I have just had a look at v3.1B (r635) and I see that there is now a dependency on googleapis.com for jquery in the admin backend.

In my opinion a standard installation of GetSimple should definitely NOT have any external dependencies.
I need to be able to work with my (local) installation (e.g. developing plugins) anywhere, anytime, without internet access (e.g. in the garden, etc.).
I don't think an administration interface should have any dependency on an external resource not under the administrator's control, as this opens up additional security holes.

As far as I know the advantage of loading from googleapis is for web users not having to download jquery etc. from various different sources - so in the frontend (themes) it is ok (and it's easy to change by the admin).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
Obviously everyone has their preferences, and I am not going to make everyone happy with whatever choice I use.

I switched it based on a thread complaining that because of caching it would be better to use a CDN version of jQuery. I see both sides - and want to choose the version that most people will be happy with.

I respect both of you, but it's getting increasingly hard to attempt to keep everyone happy with every change...
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#4
ccagle8 Wrote:Obviously everyone has their preferences, and I am not going to make everyone happy with whatever choice I use.

I switched it based on a thread complaining that because of caching it would be better to use a CDN version of jQuery. I see both sides - and want to choose the version that most people will be happy with.

I respect both of you, but it's getting increasingly hard to attempt to keep everyone happy with every change...

The caching makes a lot of sense for the site itself - the front end, because an average user browses lot's of sites - maybe only once - and by using a CDN version he has only to download jQuery once instead of 10 or 100 times.
And of course any user browsing the internet has an internet connection.

On the other side you normally only administrate one site (or a few at most), so downloading another copy of jQuery into the browser cache once doesn't make much difference compared to the hundreds of calls to administration pages. And - as opposed to a theme, where I can easily exchange the CDN link with a local version - this is not possible in the backend without loosing the ability to upgrade without problems.

So, if you want to enforce all themes to use CDN versions of js file, I'll wholeheartedly agree with you, but I think it's the wrong approach for an administration backend.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#5
I agree with Martin, it makes sense for frontend, but not for back end
|--
Die deutsche GetSimple-Webseite: http://www.Get-Simple.de = the german Get-Simple-Website!
Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#6
I think the following code taken from http://html5boilerplate.com/ should be used which offers a local copy in case CDN is not available:

Code:
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>

It is likely the user will have visited a site that has cached the CDN version so this will save another download for admin.
Reply
#7
you can load actual version using
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
or
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

with the difference that thae latter will automagically serve the latest 1.7.x *BUT* will default to a lower expire time.

looking at config from the latest beta i see an option :
Quote:Disable loading of external CDN versions of scripts (jQuery/jQueryUI)

what the point of that? Will GS offer jQuery to plugin developers so that we don't risk having multiple plugins try to load different versions of jquery from different places, or even worse, locally stored copies?

Additional, that option guarantees my GS will always use the latest jquery version, and where will it load jquery? On a few sites i prefer defer loading most .js at page bottom to speedup rendering, so some flexibility can be important.

That said i sometimes ha fun looking at the source of WP sites and realizing that many are loading 2 o 3 times different versions of jquery because the user added many plugins, and each plugin tries to load use and load its own version.
Reply
#8
Hi Marrco,

GS 3.1 by default loads Jquery from CDN.

As per the thread above, some users would prefer if we didn't load it from there especially when developing locally and no access to the internet. This option allows you to turn it off.

This is just the base libraries for the Admin backend, which are now using script queuing.

http://get-simple.info/forum/topic/3051/...e-queuing/

This is the preferred way we would like all plugin / theme writers to load scripts and styles from 3.1 onwards.
As you have seen there can be multiple versions of libraries loaded by individual plugins and this will hopefully allieviate much of this.

Thanks for the tip on just loading 7.1 , I'll change that in the SVN.

Mike...
My Github Repos: Github
Website: DigiMute
Reply
#9
While I would never use it on my development platform,… I do use it in production. The reasoning is twofold. Number one: I don't have to worry about having the latest version. Number two: this has to do with server load. While it may not amount to much, every little bit helps. Google has innumerable servers scattered around the world. These all serve to mirror copies of jQuery.
-eatons
Reply
#10
n00dles101 Wrote:As per the thread above, some users would prefer if we didn't load it from there especially when developing locally and no access to the internet. This option allows you to turn it off.

Good solution – thanks.

eatons Wrote:The reasoning is twofold. Number one: I don't have to worry about having the latest version.
n00dles101 Wrote:Thanks for the tip on just loading 7.1 , I'll change that in the SVN.

As an aside, the last thing I want on a production site is newer versions of libraries being implemented without my knowing. Newer version == more problem possibilities.

If a CDN is required, why use Google instead of jQuery's own (code.jquery.com) ?
--
Nick.
Reply
#11
hameau Wrote:As an aside, the last thing I want on a production site is newer versions of libraries being implemented without my knowing. Newer version == more problem possibilities.

using 1.7 instead of 1.7.1 will give you the latest of 1.7.x series. You won't get the 1.8 when will be released. So you should reasonably be safe about problems.

> If a CDN is required, why use Google
> instead of jQuery's own (code.jquery.com) ?

because it's the de-facto standard. And it gives you more chances that the user has already that specific version version cached.
Reply
#12
Quote:If a CDN is required, why use Google instead of jQuery's own (code.jquery.com) ?

I had the same question once and I got this answer which I think is quite reasonable:

because Google's server are spread around the world and it is quite reasonable that the CDN (the distributed code repository server) is near to the visitor's place

if you load from jquery.com, it will have the same effect as if loading locally from your server

imagine your server is in Germany, the visitor sits in Mongolia
It is obvious that a google CDN server is nearer to Mongolia than your server
so the script will load faster

Cheers, Connie
|--
Die deutsche GetSimple-Webseite: http://www.Get-Simple.de = the german Get-Simple-Website!
Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#13
So that are you recommend ?
We had all been beginners :)
Reply




Users browsing this thread: 1 Guest(s)