Back button

T

Ted

Greetings gents
In IE6 the 'Back' button returns one to the SAME POSITION in the previous
page.
How do I write that in html? I know about <a href="../pagename.htm">Back</a>
but that is to a specific page and puts cursor at the beginning.
What I want is to just simulate the 'Back' button.
Thanks for any ideas.
Ted
 
R

Roy Schestowitz

Ted said:
Greetings gents
In IE6 the 'Back' button returns one to the SAME POSITION in the previous
page.
How do I write that in html? I know about <a
href="../pagename.htm">Back</a> but that is to a specific page and puts
cursor at the beginning. What I want is to just simulate the 'Back'
button. Thanks for any ideas.
Ted

Have a look at the following. You might have to involve JavaScript.

http://www.foad.org/~abigail/HTML/Misc/back_button.html
 
B

Benjamin Niemann

Ted said:
Greetings gents
In IE6 the 'Back' button returns one to the SAME POSITION in the previous
page.
How do I write that in html? I know about <a
href="../pagename.htm">Back</a> but that is to a specific page and puts
cursor at the beginning. What I want is to just simulate the 'Back'
button. Thanks for any ideas.

You can't do this with HTML alone. You might use
<a href="../pagename.htm" onclick="window.back()">Back</a>
which will work just like the back button in JavaScript enabled browsers. In
browsers without JavaScript the browser will always
a) load '../pagename.htm' which may not be the previous page in the browsers
history - there are always other way to open a page, even if you think that
there's only one link on one page. Thus there will be a totally different
behaviour between JS and non-JS browsers for the save link.
b) jump to the top of the page. You might use a fragment
'../pagename.htm#someID', but there's no way to determine which element was
closest to the current position.
 
T

Ted

How do I write that in html? I know about <a
You can't do this with HTML alone. You might use
<a href="../pagename.htm" onclick="window.back()">Back</a>

Thanks for that. I didn't really want users to have to enable jscript...
Works fine but goes to top of page, as you said.

<a href = "javascript:history.back()"> Go back </a>
Works just like 'Back' button. Nice.

So, those without jscript enabled can use the back button
while the more adventurous will see my 'go back'.

Thanks all. You've helped a lot.
Ted
 
D

Dan

Ted said:
Thanks for that. I didn't really want users to have to enable jscript...
Works fine but goes to top of page, as you said.

<a href = "javascript:history.back()"> Go back </a>
Works just like 'Back' button. Nice.

So, those without jscript enabled can use the back button
while the more adventurous will see my 'go back'.

That's not really an improvement... the other person's example
gracefully degraded to an ordinary link if JavaScript was not enabled,
while your version will merely produce an error in that case. And
those without JavaScript will see it... it just won't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,477
Members
44,898
Latest member
BlairH7607

Latest Threads

Top