Jump to content

Loop through Parents?


utahcon

Recommended Posts

I am trying to determine the how my page is called, and I know I can use document.referrer, but I am getting mixed results when my site is framed.What I would like to do, and it may not be the best way (I am open to suggestion) is loop up through parent.document.location (or parent.document.referrer) and capture that information.How can I loop through this? I have tried making a loop to write out parent.parent.document. for as many as there are, but it isnt doing this properly.Can you help?

Link to comment
Share on other sites

try something like this

var pageHistory = Array();var i = 0;while(parent.document != null) //or undefined play with this value{   pageHistory[i] = parent.document.referrer;   i++;}

This should give you a list of the path the user took to get to your page in reverse order.

Link to comment
Share on other sites

try something like this
var pageHistory = Array();var i = 0;while(parent.document != null) //or undefined play with this value{   pageHistory[i] = parent.document.referrer;   i++;}

This should give you a list of the path the user took to get to your page in reverse order.

How far back does that run? How does it move up the levels? As I see it it would just return the same results over and over, probably in an infinite loop.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...