Forum Moderators: open

Message Too Old, No Replies

Keeping the position on an html page

         

biggin

2:57 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



Hi,

I have an internal web application, written in html, jsp, java servlets. Here's what I would like to accomplish. If a user links to another html page from the main html page, when they return to the main html page I would like to bring them to the area they were viewing before linking to the other page. Make sense? I'm sure you can use the anchor tag but I just wanted to see if there was any other way of doing this.

Thanks in advance.

MWpro

7:00 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld

If they are using the back button and not a link to get back, then most browsers should do this automatically. Unless there is some other purpose in mind, I wouldn't worry about this since I would expect people to just use the back button to get back to where they were.

biggin

7:17 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



They do not have access to the back button (current application is using VB web browser control to load internal site). I have found a way to do this with the id attribute of the <a> tag. Thanks for all your help.

tedster

7:28 pm on Aug 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are willing, how about a hint on your solution? How do you record the ID of the anchor tag that was clicked, and how do you scroll to that screen position when the user returns?

biggin

7:38 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



Here's how I did it:

Each section, on the main html page, is given a unique id (ie <a href='me.jsp' id='#me'>Visit Me</a> ).

me.jsp has two buttons; one to return home and one to save changes.

The return home button is coded as such:
<a href='home.jsp#me>
<imgsrc='image/returnHome.gif'border=0>
</a>

So when I return home, it automatically goes to the section with id=#me. This is also the same for the save button except it is performed in the java servlet.

Hope this makes sense. It has made my end users very happy with the new process.

tedster

7:40 pm on Aug 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simple and elegant. Thanks.