calling a function in parent page through iframe?

Discussion in 'HTML & Website Design' started by wordlinkz, Aug 13, 2007.

  1. #1
    Hello

    I have an iframe (code below).. what i want to check is whether this iframe has lloaded or not and if not loaded load another page(by javascript checking in main page)

    <div style="font-family:Georgia, "Times New Roman", Times, serif">
    <IFRAME NAME="mainframe" id="mainframe"  FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=580 HEIGHT=100  style="position:relative; left:16px; margin-top:90px;" onload="genurl1('/cgi-bin/nph-gov.cgi')"></IFRAME>
    </div>
    Code (markup):
    What im trying to do is make the iframe call a function in main page (which on call assigns a value to a variable.and if that variable is set i can know the page has loaded and if that variable is not set ,the iframe has not loaded)

    NOTE:the iframe src is from another domain

    I need help on gng about doing this. ...as the iframe src is another domain and will i be able to call a function in in main page thru the iframe..and assign a value.
     
    wordlinkz, Aug 13, 2007 IP
  2. wordlinkz

    wordlinkz Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i hrd parent.function()works calling frmt he iframe ...cud some one detail on that
     
    wordlinkz, Aug 13, 2007 IP
  3. MykeXero

    MykeXero Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The when javascript tries to hit the iframe from another domain may cause some security errors on FireFox and possibly on IE7 (as this was used in a common javascript exploit back in the day). Give it a shot though.

    If the error happends, you can probably lower your security settings and it should let it work.
     
    MykeXero, Aug 13, 2007 IP
  4. wordlinkz

    wordlinkz Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    lower security settings as in?
    from the client side?

    how can i ask my users to do tht that wont work out.
    i want all my users to see the result..

    Any other way mate to go about this..iframe thingy...wat if the JS file is external and both domains link to it..ohh crap im getting too confused..

    SOME ONE PLS HELP ME OUT<<<
     
    wordlinkz, Aug 13, 2007 IP