Jump to content

Show the last visited pages???


Guest FILIPPOS

Recommended Posts

Guest FILIPPOS

Hello How can I show on a page the last pages that I have visited ??? :) I allready used " document.writeln(history)" ......but it doesnot work :( I would like to show the last 3 pages that I have visited and make links to them , using their titlesThanks in advance :)

Link to comment
Share on other sites

without a scripting language, you will not be able to do that - and even then, (unless they are pages within your domain) you will only be able to track the last one (the referrer).A web browser can only remember on step at a time. Therefore your web site application can only remember what the browser can. There is no way (that I can even fathom) that you could make links on your site that were the last three page someone visited before they came to your site.Your web site/server only knows from where you can (one step back)

Link to comment
Share on other sites

<input type="button" value="1 page back" onclick="java script:history.go(-1)"></input><input type="button" value="2 pages back" onclick="java script:history.go(-2)"></input><input type="button" value="3 pages back" onclick="java script:history.go(-3)"></input>Those will only take you back as if you had clicked the back button in your browser...

Link to comment
Share on other sites

The techniques Jonas and Vamsy mention do indeed work (sorry for not offering them at first) - it was my inpression that the requirement was for an actual link that was labeled according to each of the previously visited page.

<a href="javascript: void();" onclick="history.go(-1)">title of one page ago</a><br /><a href="javascript: void();" onclick="history.go(-2)">title of two pages ago</a><br /><a href="javascript: void();" onclick="history.go(-3)">title of three pages ago</a><br />

BTW, there is no need to include the call "javascript" in the "onclick" attribute as the attribute is already reserved for javascript and therefore the action is implied by the browser. Is it technically supposed to be there?

Link to comment
Share on other sites

Is it technically supposed to be there?
No idea, but I'm kinda used to doing it, so... As long as it doesn't do any harm, it can't matter either way.
Link to comment
Share on other sites

I don't understand what you mean, Skemcin. Do you mean that can you put the funtion in the href?

Since the "onclick" attribute is only processed by the javascript engine of the browser, it's use (by it's sole nature) is already implying that javascript is going to be used. It is a javascript only attribute - HTML (for lack of a better term) ignores the attribute. Therefore there is no need to specify that you are using javascript in the attribute - the same would go for onmouseover, onmouseout, onfocus, onblur, etc.If you wan to include the function in the "href", then you will have to specifty the intent to use "javascript"
<a href="#" onclick="javascript: alert('Hello World');">A</a><br /><a href="#" onclick="alert('Hello World');">B</a><br /><a href="javascript: alert('Hello World');">C</a><br />

all do the same thing.

No idea, but I'm kinda used to doing it, so... As long as it doesn't do any harm, it can't matter either way.

I have no idea what is the "appropriate" method for coding the attribute.
Link to comment
Share on other sites

Since the "onclick" attribute is only processed by the javascript engine of the browser
onclick can't be used for vbscript? I don't really know, I make a habit of avoiding IE only scripting, but I would think you could use it to execute a vbscript?
Link to comment
Share on other sites

Sorry for bringing this back up, but I thought that it would help out if anyone still needed this.MSDN Says:

Remarks    For security reasons, the history object does not expose the actual URLs in the browser history. It does allow navigation through the browser history by exposing the back, forward, and go methods. A particular document in the browser history can be identified as an index relative to the current page. For example, specifying -1 as a parameter for the go method is the equivalent of clicking the Back button.    This object is available in script as of Microsoft Internet Explorer 3.0.
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...