Click to See Complete Forum and Search --> : document.referrer in frames


davaugust
09-05-2003, 12:30 PM
I have a frameset with two frames, say

the frameset page (frameset.html)
frameA (loaded with frame_a.html)
frameB (loaded with frame_b.html)

and another page, referrer.html.

when I click a link in frame_b.html to load referrer.html into that frame, and check document.referrer in referrer.html, the result is always the same...frameset.html.

The referrer is always defined as the frameset, not the document that was loaded into frameB, where the click originated.

here's the VERY SIMPLE code that I'm using in referrer.html...

document.write("this is the javascript referrer: " + document.referrer);

and that's it.

So my question is, Is it possible to identify the page loaded into the frame, rather than the name of the actual frameset? If so, how?

Any help you could provide would be greatly appreciated.

Thanks!

Jona
09-05-2003, 12:39 PM
I'd imagine it would be something like this...


top.frames["frame_name"].document.referrer


But it's not a standard object and personally I don't think it should be used. I'd use a server-side language to do it instead, since the only browser (I believe) that supports this unstandard object, is Internet Explorer (IE).

[J]ona

davaugust
09-05-2003, 12:44 PM
I'd prefer to do it with PHP, but unfortunately, it returns the same thing, the frameset URL.

I can't put any code on the original frame_b.html page, because the viewer may not necessarily be coming from my my pages, they may be coming from elsewhere. Therein lies the problem.

I'd be open to any suggestions about server side alternatives that may be better than PHP at determining what's going on within the frameset.

Jona
09-05-2003, 01:30 PM
If using PHP, send the PHP value in to a variable and pass that JavaScript variable to the other frame. So in one frame use PHP get get the referer (of that document), and echo() it into a JavaScript variable, and then send it to the other frame so that both frames know where they are.

[J]ona

davaugust
09-05-2003, 03:40 PM
Well, the problem is that for each document within the frameset, regardless of which frame the document is in, php returns the url of the frameset as the referrer, not the document url?

Jona
09-05-2003, 04:30 PM
Hm... Sorry, I'm at a lose for a solution.

[J]ona