Click to See Complete Forum and Search --> : Get history of a user using javascript.history object


yiannakop
June 6th, 2005, 09:16 AM
Hi!
I want to have a list of the urls of the pages a user visited. I use visual studio.net and in my aspx web form i insert the following script.

<script language="JavaScript">
var output = '';
for (var i=0;i<history.length;i++)
output += history[i] + '\n';
alert(output);
</script>

If for example the user has browsed 3 pages, the message printed by allert is:
undefined
undefined
undefined

It seems like the elements of history object cannot be seen as strings. If i print history.length using allert it prints ok.
I am using internet explorer. I am thinking that this might be the problem as I have read that for example with navigator this must work.
Does anyone know how to retrieve the urls using internet explorer?

Dr. Script
June 6th, 2005, 02:56 PM
Impossible. The history object allows you to move forward, back, or go to a certain page in the history +/-, but doesn't allow you retrieve it. That would be a huge security issue.