This discussion is archived
4 Replies Latest reply: Jan 6, 2013 10:14 PM by Sushant Sharma RSS

Handle browser back navigation when there is only 1 page.

user8249972 Newbie
Currently Being Moderated
Hi,

i have only 1 page where you can query data and can update few fields in the results table. the functions available on the page are just search, cancel (which does rollback) and save (which commits).

my problem is when the search results are displayed the browser back button becomes made available (ie if i click 'back' in the results page, it takes me to the initial search page where there was no data). since there is only 1 page when browser back is clicked, control is not sent back to processrequest atall so no point in checking for isbackNavigationfired....

since there is only 1 page is there a need to handle the browser back button ? ideally, on back button, i would like to somehow just display the standard NAVIGATION_ERROR and keep the user on whatever contents of the page they were at (ie the search results displayed page).

Thank you.
  • 1. Re: Handle browser back navigation when there is only 1 page.
    Sushant Sharma Expert
    Currently Being Moderated
    Hi,

    If you want to display an error message on browser back button, then catch the event and throw error exception:

    if(pageContext.isBackNavigationFired(true)) {
    throw new OAException("You have navigated here through Browser Back Button.",OAException.ERROR);
    }

    --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  • 2. Re: Handle browser back navigation when there is only 1 page.
    user8249972 Newbie
    Currently Being Moderated
    hi, yes i know about that. however as i had detailed in my original question, my issue is, since there is only 1 page when browser back is clicked, control is NOT being sent back to processrequest atall so no point in checking for isbackNavigationfired....

    ie the controller is not being invoked at all..... first i am not sure why it is doing that and if that is expected behavior then how can i trap the event and prevent the user from moving away from the current page ?

    thank you.
  • 3. Re: Handle browser back navigation when there is only 1 page.
    user8249972 Newbie
    Currently Being Moderated
    Any inputs ? i must do something to prevent the browser back button navigation when there is only 1 pg (issue detailed in my original post)
    thank you.
  • 4. Re: Handle browser back navigation when there is only 1 page.
    Sushant Sharma Expert
    Currently Being Moderated
    Hi,

    In that case, you can disable the browser back button using javaScript.

    For that, refer below link:
    Disable Browser back Button in OA page

    --Sushant

    Edited by: Sushant Sharma on 7 Jan, 2013 11:43 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points