Can we disable the browser 'Back' button using Javascript code or anything?

Discussion in 'Java' started by Raj, Dec 8, 2005.

  1. Raj

    Raj Guest

    Right away, the best possible solution I have is to force the 'back'
    button to forward it to the current page. The JavaScript snippet I am
    using is:

    <script language="JavaScript">
    javascript:window.history.forward(1);
    </script>

    Since I do not intend to allow the user to go back at all, I am
    wondering if there is a better way, like disabling the 'Back' button
    altogether. My quick research resulted in "NOTHING", but I just could
    not give up...any help?
     
    Raj, Dec 8, 2005
    #1
    1. Advertising

  2. In article <>,
    "Raj" <> wrote:

    > Right away, the best possible solution I have is to force the 'back'
    > button to forward it to the current page. The JavaScript snippet I am
    > using is:
    >
    > <script language="JavaScript">
    > javascript:window.history.forward(1);
    > </script>
    >
    > Since I do not intend to allow the user to go back at all, I am
    > wondering if there is a better way, like disabling the 'Back' button
    > altogether. My quick research resulted in "NOTHING", but I just could
    > not give up...any help?


    The Javascript groups are elsewhere...
    --
    Steve W. Jackson
    Montgomery, Alabama
     
    Steve W. Jackson, Dec 8, 2005
    #2
    1. Advertising

  3. Raj

    Oliver Wong Guest

    "Steve W. Jackson" <> wrote in message
    news:...
    > In article <>,
    > "Raj" <> wrote:
    >
    >> Right away, the best possible solution I have is to force the 'back'
    >> button to forward it to the current page. The JavaScript snippet I am
    >> using is:
    >>
    >> <script language="JavaScript">
    >> javascript:window.history.forward(1);
    >> </script>
    >>
    >> Since I do not intend to allow the user to go back at all, I am
    >> wondering if there is a better way, like disabling the 'Back' button
    >> altogether. My quick research resulted in "NOTHING", but I just could
    >> not give up...any help?

    >
    > The Javascript groups are elsewhere...


    Well, the subject line reads "javascript code or anything". With respect
    to Java (as in applets or JSP), I believe the answer is "no", unless the OP
    is implementing his/her own browser in Java, in which case the answer is
    "yes".

    - Oliver
     
    Oliver Wong, Dec 8, 2005
    #3
  4. Heiner Kücker, Dec 8, 2005
    #4
  5. On 2005-12-08, Raj penned:
    > Right away, the best possible solution I have is to force the 'back'
    > button to forward it to the current page. The JavaScript snippet I
    > am using is:
    >
    ><script language="JavaScript"> javascript:window.history.forward(1);
    ></script>
    >
    > Since I do not intend to allow the user to go back at all, I am
    > wondering if there is a better way, like disabling the 'Back' button
    > altogether. My quick research resulted in "NOTHING", but I just
    > could not give up...any help?


    Change your intention. I hate sites that pull stupid crap like this.

    --
    monique

    Ask smart questions, get good answers:
    http://www.catb.org/~esr/faqs/smart-questions.html
     
    Monique Y. Mudama, Dec 8, 2005
    #5
  6. Raj

    Mickey Segal Guest

    "Monique Y. Mudama" <> wrote in message
    news:...
    > Change your intention. I hate sites that pull stupid crap like this.


    Since this discussion happened to land in a Java group I will add a
    Java-related comment. Some Java applet developers have also expressed
    frustration with the browser Back button, since users sometimes click the
    Back button hoping to return to a previous screen in an applet, thus
    destroying the applet.

    One workaround that some developers have used is to run the applet interface
    in a Java Frame popped up from the applet (popup blockers don't block the
    Frame). This does not fiddle with the browser Back button, but since the
    program content is in a Frame the user does not assume mistakedly that the
    Back button is for use within the applet.
     
    Mickey Segal, Dec 8, 2005
    #6
  7. Raj

    Oliver Wong Guest

    "Mickey Segal" <> wrote in message
    news:...
    > "Monique Y. Mudama" <> wrote in message
    > news:...
    >> Change your intention. I hate sites that pull stupid crap like this.

    >
    > Since this discussion happened to land in a Java group I will add a
    > Java-related comment. Some Java applet developers have also expressed
    > frustration with the browser Back button, since users sometimes click the
    > Back button hoping to return to a previous screen in an applet, thus
    > destroying the applet.
    >
    > One workaround that some developers have used is to run the applet
    > interface in a Java Frame popped up from the applet (popup blockers don't
    > block the Frame). This does not fiddle with the browser Back button, but
    > since the program content is in a Frame the user does not assume
    > mistakedly that the Back button is for use within the applet.


    Unfortunately, they sometimes assume that since there is a new frame,
    the Applet has somehow disassociated itself with the original browser
    window, and that it is thus safe to navigate away from the page.

    The best bet, I think, is to use Java Web Start, and let the user
    download and run the program locally.

    - Oliver
     
    Oliver Wong, Dec 8, 2005
    #7
  8. Raj

    Aji

    Joined:
    Mar 8, 2010
    Messages:
    1
    prevent refresh actions while disabling back button

    Hi,

    while disabling the back button in IE using .js,It is refreshing the page.

    but i dont want to refresh the page..

    I have used:

    <script type="text/javascript">
    function noBack()
    {
    window.history.forward(1);
    }
    </script>

    In body tag..

    <body onLoad="noBack();>

    Not working properly...

    What i do



     
    Aji, Mar 8, 2010
    #8
  9. Raj

    elizas

    Joined:
    Jan 27, 2010
    Messages:
    27
    Location:
    India
    Disabling right click in browser using JavaScript

    Some times we need to disable the right click option in the web browser for security reason .The following code can be used to implement this functionality in the best way.
    <script language ="javascript" >
    function DisableRightClick()
    {
    if (event.button == 2)
    {
    alert("Right Click is not possible Here !")
    }

    }
    .onmousedown=DisableRightClick;

    </script >
     
    elizas, Apr 19, 2010
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Replies:
    1
    Views:
    619
    Curt_C [MVP]
    Dec 29, 2004
  2. Terry Olsen
    Replies:
    3
    Views:
    10,529
    nashlovebrown
    May 8, 2009
  3. sethia4u
    Replies:
    5
    Views:
    3,863
    sethia4u
    May 19, 2008
  4. Author
    Replies:
    6
    Views:
    3,101
    George
    Jan 22, 2009
  5. FAQ server
    Replies:
    0
    Views:
    154
    FAQ server
    Aug 15, 2006
Loading...

Share This Page