Skip to main content
Inspiring
October 24, 2006
Question

Back button issue

  • October 24, 2006
  • 4 replies
  • 572 views
When a user come from any site to my application, i don't want user to use back button and go back to the site he came from.

How can i disable back button in above case in IE and Firefox. What is the best solution?.

I was using below code. This is not doing what i want. This disables user going back to previous page in my application. It allow him to go back the site he came from.
<script language="javascript">
window.history.forward(1);
</script>
    This topic has been closed for replies.

    4 replies

    Participating Frequently
    October 24, 2006
    > how can i stop user click back button and go back to the site where he came from?

    You can't. There are things you can do to make it more difficult, but it's impossible to 100% guarantee that the user won't be able to go back to the site he came from. You're trying to disable something that is a core piece of functionality in every single web browser. Just like you can attempt to stop users from saving images off your site, there are always ways around it (and ultimately, all you do is piss of your userbase because you're changing the way the web works).

    So again I'll ask, why do you need to do this?
    AdomacroAuthor
    Inspiring
    October 25, 2006
    Thanks Kronin555.
    I am not worried about all possible way to stop user going back to the website where he came from.

    If i can stop using back button to go back to website where he came from is enough.

    Please let me know the solution for this.

    Participating Frequently
    October 24, 2006
    Maybe if you explain why you don't want your users to be able to go back, we can help you.

    One way to accomplish it would be to always have the entrypoint to your site open a new window. That way there is no history in that new window to go back to.
    Inspiring
    October 24, 2006
    There is alt-left arrow
    and using the broswer menu
    and right clicking
    and using the back button

    by the way, your second two statements contradict each other.
    AdomacroAuthor
    Inspiring
    October 24, 2006
    Sorry.
    Corrected.

    Once user entered my application, i don't want user click back button and go back to the site, where he can from.
    My application link is in a website as link. User click on the link and the link will take user to my application.
    Link opens in same browser. Not in new window.
    In the above situation, how can i stop user click back button and go back to the site where he came from?.
    Inspiring
    October 24, 2006
    You realize there are at least three ways we users can go back. To disable all three is a lot of work. Also, once they are in your site, do you want to prevent them from going back to yoursite page1 from yoursite page2?
    AdomacroAuthor
    Inspiring
    October 24, 2006
    What are all three ways user can go back?. Other than back button. Right click and select back on menu?. What else?

    Users are allowed to go back from page2 to page1 by hitting back button.

    I just want to disable user going out of application when they came from external site.