javascript - Load jQuery only once on many-framed page -


a key screen in application involves html page several iframes performing various functions. of these need access jquery. in interest of speeding loading time, , reducing http traffic (though know caching this), if jquery code loaded once. if page so

<html>    <head>       <script src="jquery-1.5.js" type="text/javascript"></script>    </head>       <body>          <iframe src="other.html"></iframe>          <div id="foo"> ... stuff here ... </div>       </body> </html> 

then inside other can refer parent.$('#foo') refer parent's "foo" element, not child's. there way use parent's "instance" of jquery on child document or elements in it?

have tried:

var $ = window.parent.$; $('#foo'); // parent's frame's #foo, same "window.parent.$('#foo');" 

and:

var $ = window.parent.$; $('#foo', document); // frame's #foo because current document given context 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -