Jump to content

Link to jQuery JS from Google's API library


Recommended Posts

Hi,

Currently Prestashop links to the jQuery code via: /js/jquery/jquery-1.2.6.pack.js

However, I would like to link to jQuery from Google's hosted API library. I looked through the header.php file and I don't understand where I should make the changes.

Like for example to: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js

(I can't find the packed version of it?)

How do I do link to this for all pages on my site?

Thanks!

Link to comment
Share on other sites

I wouldn't recommend using the google hosted one, unless you have a copy of jquery on your own server as a backup. Google is known to be blocked in some countries, and the server can sometimes contain a version which may have bugs.

Consider adding a condition if you do change it. I think the file is included from a core tpl somewhere in the templates folder.

Link to comment
Share on other sites

I wouldn't recommend using the google hosted one, unless you have a copy of jquery on your own server as a backup. Google is known to be blocked in some countries, and the server can sometimes contain a version which may have bugs.

Consider adding a condition if you do change it. I think the file is included from a core tpl somewhere in the templates folder.


Thanks for your reply :)

OK, so what about using another API? Like Microsoft?

I would be linking directly to a certain version of jQuery - so the bugs shouldn't be a problem.

What condition do you mean?
Link to comment
Share on other sites

Microsoft is probably less likely to be blocked than microsoft (I could be wrong so don't take my word on that), but what I mean by a condition is a conditional include statement.

So instead of including a [removed][removed] in the tpl of main header, making an if statement to check if the file has been included from google and if not use local javascript, something like:

[removed][removed] 
{!if($) /* jquery global variable doesn't exist */ 
[removed][removed]  
}



EDIT: My html tags are replaced with removed for some reason :ohh:, dunno where it says removed I put basic html for linking a javascript file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...