Hi, I've already read the readme.txt and the documentation and never found this case.

I've found on fb.js that 'all.js' from connect.facebook.net is called using jQuery.getScript which doesn't cache on user browser.
This 'all.js' script (26.5 KB) will pulled from facebook server each time the page load which is very time consuming depending on inet connection. My question: is all.js meant Not to be cached on user browser ?

after googling, I find there is a way to cache the external js with this code (I've already test it and it works):

jQuery.ajax({
			 type: "GET",
			 url: "http://connect.facebook.net/en_US/all.js",
			 success: function(){},
			 dataType: "script",
			 cache: true
		});

thank you in advance

CommentFileSizeAuthor
#2 jscache.patch548 bytesrei

Comments

Dave Cohen’s picture

Do you have a patch?

rei’s picture

StatusFileSize
new548 bytes

here it is

mrfelton’s picture

This seems like a pretty good solution. Is this being considered for inclusion? If not, why not?!

Dave Cohen’s picture

Status: Active » Needs review

Because I lost track of it....

I just checked in a change to use <script...> instead of jQuery.getScript(). Can you update to the latest and tell me whether that solves this problem.

At the same time, I'm trying to solve #1034222: load facebook javascript asynchronously. Please weigh in if you see a way to solve both problems.

abdobasha2004’s picture

does this needs jQuery? I do not load it on my site, should I load it for just this?

Dave Cohen’s picture

Drupal should initialize jquery automatically. Unless you've done something to explicitly not load it, it will be loaded. modules/fb/fb.js assumes jQuery has been loaded.