You are here: irt.org | FAQ | JavaScript | Frame | Q1056 [ previous next ]
Try the following, which will work so long as the pages are all on the same server:
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"><!-- var lastUrl = ''; function monitor() { if (lastUrl != windowFrameNameToMonitor.location.href) { alert('Changed from: ' + lastUrl + ' to: ' + windowFrameNameToMonitor.location.href); lastUrl = windowFrameNameToMonitor.location.href; } setTimeout('monitor()',1000); } function startToMonitor() { lastUrl = windowFrameNameToMonitor.location.href; setTimeout('monitor()',1000); alert(lastUrl); } //--></SCRIPT> </HEAD> <FRAMESET ROWS="50%,*" onLoad="startToMonitor()"> <FRAME SRC="test1.htm"> <FRAME SRC="test2.htm" NAME="windowFrameNameToMonitor"> </FRAMESET> </HTML>