Results 1 to 6 of 6

Thread: Returning the URL of a frame

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2002
    Posts
    61

    Returning the URL of a frame

    I have made a frameset page, which consists of three frames. Two of the frames are for navigation/menu, and the third (min) frame is the one that changes according to what's selected in the menu frames.

    What I'm trying to do is this: On one of the menu frames, display the URL of the main frame. So each time the main frame changes, it's URL is displayed in a separate frame. I know about the document.URL function which returns the URL of the local frame, but I need to return the URL of a remote frame. (The pages shown on the main frame cannot be altered to pass any value to the calling frames, because they're produced by a third party).

    Thanks.

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    There are a few ways to do this. You could run a function every second or so which checks the url of the main frame. Or else you could change all links to automatically change that text as well as load the page when they are pressed. The first one is probably simpler to implement. Now, since I hate frames I've forgotten how to do this, but here's what I'd try first:
    Code:
    url = parent.mainFrame.document.location.href
    document.getElementById('IDOfMySpan').innerHTML = "<p>"+ur+"</p>"l
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2002
    Posts
    61
    Unfortunately, the url = parent.mainFrame.document.location.href syntax doesn't work. I get "Access is denied" error on that line.

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    aaa. I think that is because the page is outside your domain. Try something like parent.mainFrame.src. but if that doesn't wok either, then you might have to change all your links?
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2002
    Posts
    61
    Almost getting there, using:
    url = parent.mainFrame.src

    But when I put "url" in an alert function, ie alert(url), the messagebox says "undefined" as the url value.

  6. #6
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    that does not mean you're close. I can't remember how to do this, and I can't be bothered to find out what it is.

    You can either wait for someone else to reply, or google for it, I'd do both.
    Have I helped you? Please Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width