Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript - getting the src of a changing iframe

Options
  • 23-03-2005 10:57pm
    #1
    Registered Users Posts: 68,317 ✭✭✭✭


    Right-ho. I have an impossibly complicated setup here, maybe someone with more experience can give me an idea.

    I have a form with a textbox. Beside it is a browse link. The intention is to allow the user to browse to their desired URL and put that URL into the text box.

    So the browse link create a popup box with an IFRAME, and a button to click when you're at the link you want. So it all works fine up until here. You click the button, and it will populate the textbox in the parent window.

    But when a user browses within the iframe, I can't get the actual iframe.src, only the last iframe.src that I set it to.

    That is, if on loading I set the src to "current.htm", and call iframe.src, I'll get "current.htm". If I change the source of the iframe via a link in the parent document (that is, the document the iframe is in - the popup window) to "new.htm", then calling iframe.src will now say "new.htm".

    However, if I now click a link within the iframe, iframe.src will continue to tell me the page is "new.htm" when it's clearly not.

    It probably doesn't help that the contents of the iframe are not on my server - this is probably where it's falling down. If I try to access any variables of the document within the iframe, e.g. document.links.length, IE's debugger tells me "Access Denied".

    Any ideas? Hope I got it across... :p

    (Would it work with normal frames? Ugh).


Comments

Advertisement