displaying the back button??

hi there i would like to ask if its possible to display a back button using javascript, to go back to the previous page? u see i have a admin/user access rights and if the user is not an admin... the user would be brought tot he login page again telling them that they either have to log in or go back to the previous page. I wanted to make the link appear only if the user is not authorised. however, the link is there regardless or the user being authorised or not. here's what i did.. well a sample of it anyway.. please help

Comments

[b][red]This message was edited by rasha at 2003-12-4 3:27:33[/red][/b][hr]: hi there i would like to ask if its possible to display a back button using javascript, to go back to the previous page? u see i have a admin/user access rights and if the user is not an admin... the user would be brought tot he login page again telling them that they either have to log in or go back to the previous page. I wanted to make the link appear only if the user is not authorised. however, the link is there regardless or the user being authorised or not. here's what i did.. well a sample of it anyway.. please help: : [code]

:

<%=Request("ErrMsg")%><%=Request("ErrMsg3")%><%=Request("ErrMsg2")%>

: <%: IF Request("ErrMsg3") = Request("ErrMsg3") then: %>: Click here to go back: <%ElseIf not Request("ErrMsg3") = Request("ErrMsg3") then%>: : <%End If%>[/code]: Hello,I understood your request but I could not get the if condition you made How you try to ask if Request("ErrMsg3") equals itself again.Anyway I think the code of the back button must be as the following

Do not miss the (-1) that tells go back one page and if you type (-2) this means go back 2 pages and so onI hope this help.

1. history.back()" is correct, but it will only take you 1 page back. Sometimes it's impossible to keep track how the users got to a certain page. A simple "Go back" link will not necessary take them to the login page. I would recommend server-side alternative for page redirect which is Response.Redirect "login.asp" as you're using ASP anyway or Location.href = "login.asp" in Javascript.

If you don't want the link show up in the else branch, don't put it there.

: [b][red]This message was edited by rasha at 2003-12-4 3:27:33[/red][/b][hr]: : hi there i would like to ask if its possible to display a back button using javascript, to go back to the previous page? u see i have a admin/user access rights and if the user is not an admin... the user would be brought tot he login page again telling them that they either have to log in or go back to the previous page. I wanted to make the link appear only if the user is not authorised. however, the link is there regardless or the user being authorised or not. here's what i did.. well a sample of it anyway.. please help: : : : [code]

: :

<%=Request("ErrMsg")%><%=Request("ErrMsg3")%><%=Request("ErrMsg2")%>

: : <%: : IF Request("ErrMsg3") = Request("ErrMsg3") then: : %>: : Click here to go back: : <%ElseIf not Request("ErrMsg3") = Request("ErrMsg3") then%>: : : : <%End If%>[/code]: : : Hello,: I understood your request but I could not get the if condition you made : How you try to ask if Request("ErrMsg3") equals itself again.: Anyway I think the code of the back button must be as the following: : Do not miss the (-1) that tells go back one page and if you type (-2) this means go back 2 pages and so on: I hope this help.: : : : :

[hr][grey]To err is human, but to really foul things up requires a computer. (Farmers Almanac)[/grey] :-)