Hello,
To avoid the loading of multiple Jquery in my application using
Iframe, I would know if anybody has succeeded in using a single Jquery
instance (in the same domain name).

myexample.html
------------------------
<html>
<head><script type="text/javascript" src="jquery.js"></script></head>
<body>
<div id="myparent">Hello world!</div>
<iframe id="myiframe" name="myiframe" src="myiframe.html"/>
</body>
</html>

myiframe.html
--------------------
<html>
<head>
<script>
var $ = window.parent.$;
var jQuery = window.parent.jQuery;
$().ready(function() {
   alert('jquery loaded in iframe');
   alert($("#myparent", parent.document).html());
   alert($("#mycontent", this).html());
});
</script>
</head><body><div id="mycontent">Working in iframe !</div></body></
html>


When executing myexample.html :
=> alert box #1 : "jquery loaded in iframe"
=> alert box #2 : "Hello world!"
=> alert box #3 : null    <=== must be "Working in iframe !"

Any idea on a solution ?
regards
Frederic

Reply via email to