Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript - getting the src of a changing iframe

  • 23-03-2005 10:57PM
    #1
    Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭


    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