You are here: irt.org | FAQ | JavaScript | Frame | Q1111 [ previous next ]
Only if the url in the other frame comes form the same server as the page that 'snoops' - otherwise a security error occurs.
Have this in the frameset:
<html>
<head>
<script language="JavaScript"><!--
saveUrl = '';
function hasChanged() {
var currentUrl = top.otherframe.location.href;
if (currentUrl != top.saveUrl && top.saveUrl != '') {
alert('Page changed from ' + saveUrl + '\nto ' + currentUrl);
}
saveUrl = currentUrl;
setTimeout('top.hasChanged()',10000); // test every 10 seconds
}
//--></script>
</head>
<frameset onLoad ="top.hasChanged()">
...
</frameset>The script can also be in one frame, then "top." must be changed to "top.framename." everywhere but the onLoad stays unchanged.