Click to See Complete Forum and Search --> : Displaying the browser history


Ash
05-30-2003, 03:44 AM
Hi,

I'm trying to find a way to use history.go to see what sites our visitors look at before they come to ours, but not having any luck, cos document.write(history.go(-1)) has the same effect as history.go(-1)

I found the following function

String getHistory () {
StringBuffer history = new StringBuffer();
for (int i = 0; i < log.size(); i++) {
LogEntry entry = (LogEntry) log.elementAt(i);
history.append (entry.toString() + "\n");
}
return history.toString();
}

but can't get it working, so I thought I'd seek professional help ;)

Any help most appreciated,
Ash

AdamGundry
05-30-2003, 03:54 AM
History.go(-1) does not return the previous address, it is a method which goes there. Browser security restrictions prevent you from reading the history via Javascript. If you must do this, you probably need a signed script (http://www.mozilla.org/projects/security/components/signed-scripts.html).

Adam

Ash
05-30-2003, 03:59 AM
I've also heard that the line

document.writeln("<B>history is</B> " + history);

should display everything, but all I get is history is undefined

khalidali63
05-30-2003, 08:29 AM
Originally posted by Ash
I've also heard that the line

[/i]
WHich is wrong,if history objects spits anything out for user to manipulate it means the browser security has been compromised.
The reason historuy only uses its built in static functions is to hide the user surfing behavior,
you can use history.go(index)

and if there is a entry in the history for that index it will take you thereor read about javascript
at
http://devedge.netscape.net