Is there any method to avoid loading js files of iframe. For example, if I loaded jquery from the main (parent) page, and don't want to load an 'extra' jquery of iframe. How could it possible?
Generally, it is about calling javascript functions in iframes, which is already loaded from parents.
Generally, it is about calling javascript functions in iframes, which is already loaded from parents.
Generally, it is rather a matter of when to use iframes. If it belongs to the same domain, why to load it in an iframe? Can't you use sever-side code includes?
Is there any method to avoid loading js files of iframe. For example, if I loaded jquery from the main (parent) page, and don't want to load an 'extra' jquery of iframe. How could it possible?
Generally, it is about calling javascript functions in iframes, which is already loaded from parents.
You could try preceding all references to the code with parent. , although there could be circumstances under which the parent code may not be loaded when called by the iframe.
For instance if you had something like this:
Code:
<script type = 'text/javascript' src = 'mysource.js'></script>
<iframe src = 'myfile.htm'>
<script type='text/javascript'>
// run code from 'mysource.js'
</script>
The content of 'mysource.js' is certain to be loaded when called by the script block below, but I'm not sure that it's guaranteed to be available for the iframe.
In any case the only extra overhead loading the same file into two pages should be the memory usage, since the file is cached and downloaded only once.
Where used, return should be executed unconditionally and always as the last statement in the function.
That's my signature, it's not part of the damn post!
Actually the browser doesn't cache the script at all (in iframe). Checking with Firebug NET option shows that fact.
Dear Kor, there are many cases we have to use iframe, especially when the site is highly interactive.
Originally Posted by Logic Ali
You could try preceding all references to the code with parent. , although there could be circumstances under which the parent code may not be loaded when called by the iframe.
For instance if you had something like this:
Code:
<script type = 'text/javascript' src = 'mysource.js'></script>
<iframe src = 'myfile.htm'>
<script type='text/javascript'>
// run code from 'mysource.js'
</script>
The content of 'mysource.js' is certain to be loaded when called by the script block below, but I'm not sure that it's guaranteed to be available for the iframe.
In any case the only extra overhead loading the same file into two pages should be the memory usage, since the file is cached and downloaded only once.
Bookmarks