Fetching latest URL of a frame...

H

hunglm

Hi all,

I'm trying to get the latest URL that a user visited in the frame.
But it just doesn't work.

function setURL() {
//document.cc.fm.URL.value=document.main.location.href;
alert("onLoad");
alert("Page "+document.frames[0].location.href+" is loaded");

}
......

<FRAMESET rows="*,40%" >
<FRAME src="about:blank" name="main" onChange="setURL();">
<FRAME src="cc.html" name="cc">

What's the problem?
 
M

Martin Honnen

hunglm wrote:

I'm trying to get the latest URL that a user visited in the frame.
But it just doesn't work.

function setURL() {
//document.cc.fm.URL.value=document.main.location.href;
alert("onLoad");
alert("Page "+document.frames[0].location.href+" is loaded");
<FRAME src="about:blank" name="main" onChange="setURL();">

Who (or which documentation) told you that there is an onchange event
handler for <frame> elements? That handler attribute doesn't exist.
Some browsers (IE5.5/6, Netscape 7, Mozilla, latest Opera (7.5x) support
<frame onload="..." src="whatever.html">
so that handler could help but I am not sure whether Safari, Konqueror
and older Opera 7.xy support that.
 
H

hunglm

Martin Honnen said:
hunglm wrote:

I'm trying to get the latest URL that a user visited in the frame.
But it just doesn't work.

function setURL() {
//document.cc.fm.URL.value=document.main.location.href;
alert("onLoad");
alert("Page "+document.frames[0].location.href+" is loaded");
<FRAME src="about:blank" name="main" onChange="setURL();">

Who (or which documentation) told you that there is an onchange event
handler for <frame> elements? That handler attribute doesn't exist.
Some browsers (IE5.5/6, Netscape 7, Mozilla, latest Opera (7.5x) support
<frame onload="..." src="whatever.html">
so that handler could help but I am not sure whether Safari, Konqueror
and older Opera 7.xy support that.

Uh...
Well , thanks, but that's not the point for me. My problem is why

alert("Page "+document.frames[0].location.href+" is loaded");

doesn't work. "onChange=..." is orginally "onLoad=..." , I'm sorry for
that but it just worked for me.


Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top