Forms in iFrames & sharing js libraries

I have a form that contains several other forms in iFrames. --The forms span across multiple databases.

–All of the forms use jQuery.

–All of the jQuery scripts are in a separate database.

Rather than having to load jQuery for each form, I was wondering if there was a way to load the library once and point the all of the forms to the same library.

Subject: Forms in iFrames & sharing js libraries

Yes, but it’s a pain in the butt:

top.frameWithJQuery.namespace.jQFunction();

… and pray that “this” doesn’t get lost along the way. On the other hand, if the URLs used to load JQuery are all the same, it only needs to download once, even if each frame gets its own instance of the script.

Subject: RE: Forms in iFrames & sharing js libraries

Q1: So if I have jQuery in a database, and I have a web page with 5 forms in iFrames, and each form within an iFrame points to the same jQuery database, the scripts will only load once?

Q2: What if the forms are in different directories so the path isn’t exactly the same but they point to the same jQuery files?

Subject: RE: Forms in iFrames & sharing js libraries

As long as the resolved URL to JQuery is exactly the same, the browser will use the same cached version of the script.

Subject: RE: Forms in iFrames & sharing js libraries

Thanks Stan. Once again you have been a great help.