SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detect frame URL change

    Hi.

    I'm currently working on something that requires me to effectively recreate the navigation bar of the browser to allow me to monitor where the user is going (for an online game.)

    They way i've chosen to do this, is to have a small top frame, with the URL bar, home, back refresh etc, and then another frame below with the site the user wants to look at.

    But my problem is, from the top frame (called topbar) how would i detect if the url of the bottom frame (called bottomb) has changed.

    I've got it to work fine when the user types the URL in the bar and presses go (obviously easy) but how would i update the value of my bar if the user click on a hyperlink whilst browsing.

    Basically, from frame 1, how do i detect if the url in frame 2 has changed, but without an action (i know that's pretty much defying the point of javascript but shhh lol)

    One way of doing it is to tell the frame 2 to change the value of the bar in frame 1 to the correct adress, however this only works if i actually control the page in frame 2, which i wont in a lot of cases.

    So for example, say the user type in www.google.co.uk in my custom URL bar in frame 1, frame 2 goes to google and the url stays as google. Say the user then types something in the search box in google and hits go, my url bar still things the url of frame 2 is www.google.co.uk (when really its http://www.google.co.uk/search?sourc...77&q=something )

    Hope it's clear what i'm trying to achieve.

    Thanks in advanced.

    Dom.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi d0minic,

    One idea would be to have a timer event listener in frame1 which continually monitors the location of frame2.

  3. #3
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops. Scratch that idea. I forgot that you can't do that for security reasons. It would work if all the pages were on the same site


Bookmarks

Posting Permissions

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