Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

[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]

Comments

  • rasharasha Posts: 25Member
    [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.




  • lillulillu Posts: 308Member
    Hi,

    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.

    2. [code]<%If Request("ErrMsg3") Then%>
    Go back
    <%Else%>
    <%End If%>[/code]

    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] :-)

Sign In or Register to comment.