views:

42

answers:

1

Hello! I have the following situation. I have 2 frames (top and bottom). The upper frame monitors the current loaded page in the bottom frame. How can I know if the users changed the location of that frame (the url)? So I want to know when the user, press a link in that page, that goes somewhere.

I found something like this here: http://stackoverflow.com/questions/1091661/detect-div-content-changes-with-jquery , but it doesn't help me (I think).

Could you give me some ideas?

Thanks, Timotei

EDIT: The bottom frame is on another domain, so according to this: http://stackoverflow.com/questions/1222687/jquery-permission-denied-different-domain-name is not possible.

So, to put it other way, is there any method to "monitor" the pages a users surfs, using any other in-browser method?

+1  A: 

You maybe can store the location of the iframe, then create a interval that will look if the SRC has changed.

var theSrc = document.getElementById('myframe').src;

setInterval(function(){
  if (document.getElementById('myframe').src != theSrc) {
    // the URL has changed
  }
}, 5000);

Hope it works :)

Hisamu
I'll try it and see if it works. Thanks.
Timotei Dolean
It doesn't work. After I read another bunch of documents it seems impossibe to do what I want because of some security policies. : http://stackoverflow.com/questions/1222687/jquery-permission-denied-different-domain-name
Timotei Dolean