Click here to Skip to main content
15,748,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to know iframe is completeley loaded or not programtically?
There is one iframe in mypage...,at runtime i will set src attribute of this iframe , after iframe loaded i want to set height and width of this iframe and then open that iframe in to jdialog using jquery...

code look like this...
<script type="javascript">
           function ShowDialog() {
            //here after this page load completely in iframe i want to set height and width of this iframe.then
<div id="dvmodify">
           <iframe id="ifrmmodify"/>

Updated 19-Jan-11 7:46am
TweakBird 19-Jan-11 13:26pm    
Edited for code blocks.

Use event onload of your iframe.
Just one example:[^].
Share this answer
jatinchandarana 19-Jan-11 13:45pm    
this i frame is inside div and after iframe completely loaded i want to open dialog , i i write onload event then when page first time load a dialog will open pls see the code i write...
Sergey Alexandrovich Kryukov 19-Jan-11 15:43pm    
In your unload handler, open the dialog or whatever, why it's a problem?
Manfred Rudolf Bihy 19-Jan-11 15:42pm    
Looks like another unavailing effort on my side, but I tried what you proposed as an experiment and lo and behold it works. I just can't tell why they don't put the advice to use that we pour on them daily.
Sergey Alexandrovich Kryukov 19-Jan-11 15:44pm    
So it works? Great. I did not expect someone would bother to code and test it. I already voted 5" for you.
Espen Harlinn 19-Jan-11 15:50pm    
5+ Good link and verified by Manfred, that's a good community effort :)
Hi I put together an example look here:

    <link rel="stylesheet" href="./scripts/css/ui-lightness/jquery-ui-1.8.8.custom.css"/>
    <script type="text/javascript" src="./scripts/jquery-1.4.4.js"></script>
    <script type="text/javascript" src="./scripts/js/jquery-ui-1.8.8.custom.min.js"></script>
    <div id="dvmodify">
        <iframe id="ifrmmodify"></iframe>
    <script type="text/javascript">
        function ShowDialog() {
            // setting the width and height of the iframe I leave to you

        function SetIFrameSource() {
            $("#ifrmmodify").attr("src", "./Test.html");

        $(function() { SetIFrameSource(); });

I hope this gives you an idea how to accomplish your task!

Best Regards,
Share this answer
Espen Harlinn 19-Jan-11 15:51pm    
Good work Manfred :)
Manfred Rudolf Bihy 19-Jan-11 16:34pm    
Thanks Espen!
jatinchandarana 20-Jan-11 12:21pm    
thank you it help me...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900