How to Restrict/Disable back button in browser

Hi guys,
I am writing a enterprise web application using ADF. I am using JDeveloper 11.1.2.0.0.
I want to restrict/ disable browser back/forward buttons in all my .jspx and .jsf pages.
It was discussed in following thread as well.
how to Restrict/Disable  back button in browser
Can somebody give a way to do this please.
Regards !
Sameera

Hi Sudipto,
This is one of my .jspx pages. I wonder where should I put that javascript code. I have tried in several places and didn't work.
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document title="Registration Page" id="d1">
<af:messages id="m1"/>
<af:form id="f1">
<af:pageTemplate viewId="/MyPageTemplate.jspx" id="pt1">
<f:facet name="MainPageRegion">
<af:group id="g1">
<af:panelSplitter splitterPosition="454"
inlineStyle="width:943px; height:200px;"
id="FirstRN">
<f:facet name="first">
<af:panelGroupLayout layout="scroll" id="pgl1">
<af:outputText value="Registration Details"
inlineStyle="font-weight:bold;" id="ot1"/>
<af:separator id="s1"/>
<af:panelFormLayout labelAlignment="start" id="pfl1">
<f:facet name="footer"/>
<af:panelLabelAndMessage label="#{bindings.RegNum.hints.label}" id="plam1">
<af:outputText value="#{bindings.RegNum.inputValue}" id="ot2"/>
</af:panelLabelAndMessage>
<af:selectOneChoice value="#{bindings.ProcType.inputValue}"
label="#{bindings.ProcType.label}"
required="#{bindings.ProcType.hints.mandatory}"
shortDesc="#{bindings.ProcType.hints.tooltip}" id="soc1">
<f:selectItems value="#{bindings.ProcType.items}" id="si1"/>
</af:selectOneChoice>
<af:selectOneChoice value="#{bindings.RegStatus.inputValue}"
label="#{bindings.RegStatus.label}"
required="#{bindings.RegStatus.hints.mandatory}"
shortDesc="#{bindings.RegStatus.hints.tooltip}" id="soc2">
<f:selectItems value="#{bindings.RegStatus.items}" id="si2"/>
</af:selectOneChoice>
<af:panelLabelAndMessage label="#{bindings.TotalUsdAmt.hints.label}" id="plam2">
<af:outputText value="#{bindings.TotalUsdAmt.inputValue}" id="ot3">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.TotalUsdAmt.format}"/>
</af:outputText>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.TotalPfiAmt.hints.label}" id="plam3">
<af:outputText value="#{bindings.TotalPfiAmt.inputValue}" id="ot4">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.TotalPfiAmt.format}"/>
</af:outputText>
</af:panelLabelAndMessage>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="pgl2">
<af:outputText value="Creation Details"
inlineStyle="font-weight:bold;" id="ot5"/>
<af:separator id="s2"/>
<af:panelFormLayout labelAlignment="start" id="pfl2">
<f:facet name="footer"/>
<af:panelLabelAndMessage label="#{bindings.CreatedByName.hints.label}" id="plam4">
<af:outputText value="#{bindings.CreatedByName.inputValue}" id="ot6"/>
</af:panelLabelAndMessage>
<af:panelLabelAndMessage label="#{bindings.CreationDate.hints.label}" id="plam5">
<af:outputText value="#{bindings.CreationDate.inputValue}" id="ot7">
<af:convertDateTime pattern="#{bindings.CreationDate.format}"/>
</af:outputText>
</af:panelLabelAndMessage>
<af:selectOneChoice value="#{bindings.RequestedBy.inputValue}"
label="#{bindings.RequestedBy.label}"
required="#{bindings.RequestedBy.hints.mandatory}"
shortDesc="#{bindings.RequestedBy.hints.tooltip}" id="soc3">
<f:selectItems value="#{bindings.RequestedBy.items}" id="si3"/>
</af:selectOneChoice>
<af:panelLabelAndMessage label="#{bindings.DepartmentName.hints.label}" id="plam6">
<af:outputText value="#{bindings.DepartmentName.inputValue}" id="ot8"/>
</af:panelLabelAndMessage>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
<af:panelSplitter inlineStyle="width:944px; height:132px;"
splitterPosition="452" id="SecondRN">
<f:facet name="first">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="pgl3">
<af:outputText value="Notes to Buyer"
inlineStyle="font-weight:bold;" id="ot9"/>
<af:separator id="s3"/>
<af:inputText value="#{bindings.NotesBuyer.inputValue}"
simple="true"
required="#{bindings.NotesBuyer.hints.mandatory}"
columns="#{bindings.NotesBuyer.hints.displayWidth}"
maximumLength="#{bindings.NotesBuyer.hints.precision}"
shortDesc="#{bindings.NotesBuyer.hints.tooltip}"
rows="5" id="it1">
<f:validator binding="#{bindings.NotesBuyer.validator}"/>
</af:inputText>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="pgl4">
<af:outputText value="Party Notes"
inlineStyle="font-weight:bold;" id="ot10"/>
<af:separator id="s4"/>
<af:inputText value="#{bindings.PartyNotes.inputValue}"
simple="true"
required="#{bindings.PartyNotes.hints.mandatory}"
columns="#{bindings.PartyNotes.hints.displayWidth}"
maximumLength="#{bindings.PartyNotes.hints.precision}"
shortDesc="#{bindings.PartyNotes.hints.tooltip}"
rows="5" id="it2">
<f:validator binding="#{bindings.PartyNotes.validator}"/>
</af:inputText>
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
<af:spacer width="10" height="20" id="s5"/>
<af:outputText value="Registration Lines"
inlineStyle="font-weight:bold;" id="ot11"/>
<af:separator id="s6"/>
<af:commandButton text="Add Item"
disabled="#{RegistrationBean.disableAddItemBtn}"
action="CatalogPage" id="cb1"/>
<af:commandButton text="Search Item"
action="ItemLitsPage"
disabled="#{RegistrationBean.disableSearchCataBtn}" id="cb2"/>
<af:table value="#{bindings.RegLinesRegPageVO.collectionModel}"
var="row" rows="#{bindings.RegLinesRegPageVO.rangeSize}"
emptyText="#{bindings.RegLinesRegPageVO.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.RegLinesRegPageVO.rangeSize}"
width="900" id="t1">
<af:column sortProperty="ProductCode" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.ProductCode.label}" id="c1">
<af:outputText value="#{row.ProductCode}" id="ot12"/>
</af:column>
<af:column sortProperty="Qty" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.Qty.label}" id="c2">
<af:outputText value="#{row.Qty}" id="ot13">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RegLinesRegPageVO.hints.Qty.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="UnitPrice" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.UnitPrice.label}" id="c3">
<af:outputText value="#{row.UnitPrice}" id="ot14">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RegLinesRegPageVO.hints.UnitPrice.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="Currency" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.Currency.label}" id="c4">
<af:outputText value="#{row.Currency}" id="ot15"/>
</af:column>
<af:column sortProperty="UsdAmount" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.UsdAmount.label}" id="c5">
<af:outputText value="#{row.UsdAmount}" id="ot16">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RegLinesRegPageVO.hints.UsdAmount.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="UsdPfiAmount" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.UsdPfiAmount.label}" id="c6">
<af:outputText value="#{row.UsdPfiAmount}" id="ot17">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RegLinesRegPageVO.hints.UsdPfiAmount.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="UsdTotalAmount" sortable="false"
headerText="#{bindings.RegLinesRegPageVO.hints.UsdTotalAmount.label}" id="c7">
<af:outputText value="#{row.UsdTotalAmount}" id="ot18">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.RegLinesRegPageVO.hints.UsdTotalAmount.format}"/>
</af:outputText>
</af:column>
</af:table>
</af:group>
</f:facet>
<f:facet name="ActionButtonBarRegion">
<af:group id="g2">
<af:commandButton actionListener="#{bindings.Commit.execute}"
text="Save"
disabled="false" id="cb3">
<af:setActionListener from="#{false}"
to="#{RegistrationBean.disableAddItemBtn}"/>
<af:setActionListener from="#{false}"
to="#{RegistrationBean.disableSearchCataBtn}"/>
<af:setActionListener from="#{bindings.RegistrationId.inputValue}"
to="#{pageFlowScope.regToEdit}"/>
</af:commandButton>
<af:commandButton text="Home" action="HomePage" immediate="true" id="cb4"/>
</af:group>
</f:facet>
<f:attribute name="PageTitle" value="Registration Page"/>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
Regards !
Sameera
Edited by: samme4life on May 17, 2012 2:39 AM
Edited by: samme4life on May 17, 2012 2:42 AM

Similar Messages

  • How can I disable back button

    How can I disable the back button and/or prevent the back button displaying my recent searches on right click ?

    Set the pref <b>browser.sessionhistory.max_entries</b> to 0 on the <b>about:config</b> page.
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • How can I disable back, forward and refresh button in browser running ADF 11.1.2.2

    How can I disable back, forward and refresh button in browser running ADF 11.1.2.2?

    I insert the java script into ADF page. But it does not work. The ADF source look like below. Did I insert into wrong region?
       <f:view>
            <af:document id="d1">
                <af:messages id="m1"/>
                <af:resource type="javascript">
                  window.history.forward();
                  function noBack() {
                      window.history.forward();
                </af:resource>
                <af:form id="f1">
                    <af:pageTemplate viewId="/template/temp2.jspx" id="pt1">
                        <f:facet name="body">
                            <af:panelStretchLayout id="psl1" topHeight="30px">
                                <f:facet name="bottom"/>
                                <f:facet name="center">
                                    <af:panelBox text="Incident List" id="pb1">
                                        <f:facet name="toolbar"/>
                                        <af:panelCollection id="pc1">
                                            <f:facet name="menus"/>
                                            <f:facet name="toolbar"/>
                                            <f:facet name="statusbar"/>
                                            <af:table value="#{bindings.ServiceRequestMain.collectionModel}" var="row"
                                                      rows="#{bindings.ServiceRequestMain.rangeSize}"

  • How to use a back button in action pages?

    Hi all,
    I have created a user login page,home page and user profile page.
    If the user provide correct username and password in the login page he will be taken to home page.
    In the home page he will be having his username and a link to view his profile.
    When the user click on the link "My Profile(user profile)" he wil be taken to that page.
    In my profile page the user can edit only his firstname,lastname and password .
    On the user profile page i have placed a Back Button(using javascript: on onclick event i have used history.back()) to go back to home page after editing his profile.
    If the user edit his profile for n-number of times then atlast if he wants to go back to home page-then he wil cilck the back button.
    Now the problem occurs like the back button not going to home page and it simply going back with the edited history.
    How to use a back button in action pages; without repeating the actions done on the page; how to redirect to the users home page?
    I simply used the hyperlink in userprofile page to go to home page but when i click onit it is displaying blank home page.
    I'm using hibernate orm mapping; cflogin and cflogout tags.
    Any help appreciated,
    Chandru P

    chandrup wrote:
    Hi Dan,
    Dan Bracuk wrote:
    Use an anchor tag.
    I simply used the hyperlink(<a href="home.cfm">Home</a>) in userprofile page to go to home page but when i click onit it is displaying blank home page.
    I can see your problem. You may use javascript:history.go(-1), javascript:history.go(-2), ..., to go back one page, two pages, and so on. But how does one go back an arbitrary n pages? The link href="home.cfm" isn't a good solution for the browser. It makes a new call to the server which, as you may have discovered, can overwrite all the changes made at the browser. 
    You should use the Javascript variable history.length. If you open n links in succession, starting from page0.cfm, then the browser holds the value of history.length as n. So, experiment with something like
    <a href="javascript:history.go(-history.length)">Go home</a>
    or
    <a href="javascript:history.go(-history.length+1)">Go home</a>

  • Back button of browser

    hi,
    i have built an application and want to disable back button for the user. how can i do it
    Thnx,

    You can't doing it using Java.
    You can override the history.back event with history.forward in JavaScript (which has nothing to do with Java) or you can simply not show the nav bar. Which doesn't mean the user couldn't use the backspace key instead...
    Short:
    - you're wrong here
    - you can't

  • Display data when Back button of Browser is pressed

    Hi All,
    Thanks for Reading my query.
    I have an issue with display of data in Jsp page:
    I have 2 JSP pages, wherein i entered data in page1 and clicked submit to see page2.Now i pressed back button of browser and im able to see data which i entered.I require the feilds in page1 to be cleared when back button is pressed in page2.Could any one please tell me how to handle this issue.
    Please help me out.
    cheers,
    sharath

    you can use the HTML header set pragma - no-cache expires - 0 and cache-control - no cache property so whenever you will press back button of browser it will show the message page has been expired. You can find the proper syntax on any HTML site

  • How does one disable a button in the web UI?

    How does one disable a button in the web UI? I am trying to disable the edit button in the web UI for Accounts. What are the steps to take in order to accomplish that?

    Hi Abdul,
    Locate the Toolbar group group for that application. It should be ACC_OIC01 in your case. You can deactivate a specific button (event) under the toolbar group.
    Regards,
    J.Prabananth

  • How can we prevent back button  using java script

    how can we prevent back button using java script

    Would be quicker for you to google for javaScript
    javascript:window.history.forward(-1);

  • Disable back button in Mozilla firefox

    Hi all
    i need a help.....in my project i need to disable back button in firefox(i.e)preventing user to go back...is that possible..i have googled for many hours.....i didnot get the answer..please help me

    See this thread:
    http://forum.java.sun.com/thread.jspa?forumID=33&threadID=5248681

  • How to disable Back Button

    Hi
    i want to dactivate back button of my IE browser in JSp
    how it will happen
    Thanks

    How abt this?
    hi..hi
    <body onunload=fun(false)>
    <form>
    <Input type=submit onClick=fun("true") value=submit>
    </form>
    <script>
    function fun(what) {
    if(what) {
         //do actual submit;
    } else{
         alert("hey dont click that back button :-(  ");
         location.href="a.html";
    </script>
    </body>
    Save the above file as a.html and try..forgot to mention!!

  • How to work with Back Button of Web Browser for Flex Application

    Hi...........
    I am developing a Web Site for that I have created 10 MXML Components for 10 links I am using ViewStack in Home Page and I added the 10 components to this ViewStack and I am using 10 links for 10 Components
    My problem is that When I am going through links it's fine but in my Web Browser I am not getting Back Button enabled for previous page to go
    Please help me.............................. 

    Hi,
    Here a Flex3 example:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         creationComplete="initApp()">
         <mx:Script>
              <![CDATA[
                   import mx.events.BrowserChangeEvent;
                   import mx.managers.IBrowserManager;
                   import mx.managers.BrowserManager;
                   import mx.utils.URLUtil;
                   public var browserManager:IBrowserManager;
                   private function initApp():void {
                        browserManager = BrowserManager.getInstance();
                        browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseURL);
                        browserManager.init("", "Shipping");
                   private var parsing:Boolean = false;
                   private function parseURL(event:Event):void {
                        parsing = true;
                        var o:Object = URLUtil.stringToObject(browserManager.fragment);
                        if (o.view == undefined)
                             o.view = 0;
                        tn.selectedIndex = o.view;
                        browserManager.setTitle((tn.selectedIndex == 0) ? "Shipping" : "Receiving");
                        tn.validateNow();
                        var details:Boolean = o.details == true;
                        if (tn.selectedIndex == 0)
                             shipDetails.selected = details;
                        else
                             recvDetails.selected = details;
                        parsing = false;       
                   private function updateURL():void {
                        if (!parsing)
                             callLater(actuallyUpdateURL);
                   private function actuallyUpdateURL():void {
                        var o:Object = {};
                        var t:String = "";
                        if (tn.selectedIndex == 1) {
                             t = "Receiving";
                             o.view = tn.selectedIndex;
                             if (recvDetails.selected)
                                  o.details = true;
                        } else {
                             t = "Shipping";
                             o.view = tn.selectedIndex;
                             if (shipDetails.selected)
                                  o.details = true;
                        var s:String = URLUtil.objectToString(o);
                        browserManager.setFragment(s);
                        browserManager.setTitle(t);
              ]]>
         </mx:Script>
         <mx:TabNavigator id="tn" change="updateURL()" width="300">
              <mx:Panel label="Shipping">
                   <mx:CheckBox id="shipDetails" label="Show Details" change="updateURL()" />
              </mx:Panel>
              <mx:Panel label="Receiving">
                   <mx:CheckBox id="recvDetails" label="Show Details" change="updateURL()" />
              </mx:Panel>
         </mx:TabNavigator>
    </mx:Application>

  • How can detect user's click on "Back" button in browser?

    Hi java gurus:
    I use servlet as a controller to show pages. If user click "Back" button several times, and execute an operation in the page, at that time the attributes in the session is for the page before clicking "Back". So the operation run with the wrong data. How can I deal with this condition? Can I detect user's click on "Back"?
    Thanks for any suggestion.
    allan

    Any request made by a client could be "stopped" after
    the session has been updated with the new timestamp.
    This would leave the client sitting viewing a page
    that has an "out of sequence" timestamp in the hidden
    field with no way to get out.Yes, the client could stop the request and have no valid unique String to submit. However, the technique is only designed to detect out of sequence pages, it does not mean the user has no way out! Remember that the server side code can respond to the fact that the request is out of sequence in any way. Certainly, they could choose to lock the user out, but more often than not it will be a more intelligent response than that.
    This problem could also manifest itself if the client
    makes a request of type a then changes their mind and
    makes a request of type b before the type a request
    has been returned.Yes, in this case the request would be considered 'out of sequence'. It's really a variation of the condition you mentioned earlier.
    Any ideas?Again, the code can respond to the fact that the request is out of sequence in several different ways. It may, for example, ignore the fact that it is out of sequence if it finds the data it needs in the session store. It may force the user to start over, or any other action which makes sense -- It's going to be very application dependent.
    Good luck,
    -Derek

  • How to clear the portal form fields while clicking on Back button in browser?

    Hi All,
    I have a portal form, which calls another form. When I types in a value and presses submit, it goes to the new
    form with the information on it. When I click on the back button in the browser, it will show the last value user
    has entered. I want to clear these values, when I click on the back button in the browser.
    Any help is greatly appreciated.
    Thanks & regards,
    Nevin

    Lets assume that the name of the field, whose value you want to clear off,
    is SEARCH_TEXT :-
    Steps :-
    1> Edit the form and goto the Additional PL/SQL Section
    2> Add the following code to the "...after displaying the page" area
    declare
    l_form_name varchar2(200);
    l_sess_id integer;
    begin
    l_form_name := p_session.get_module().get_name();
    l_sess_id := p_session.get_id();
    htp.p('<script>
    var fieldName = "'||l_form_name||'.DEFAULT.SEARCH_TEXT.01";
    var formObj = document.WWVM'||l_sess_id||';
    for (var i=0; i < formObj.length; i++){
    if (formObj.elements.name == fieldName){
    formObj.elements[i].value = "";
    break;
    </script>
    end;

  • How can I disable a button ?

    Hi!
    How can I disable the a button ?
    There is a if statement. If it returns a false the button must be disabled.
    Regards
    sas
    Edited by: erdem sas on Jan 15, 2008 3:06 PM
    Edited by: erdem sas on Jan 15, 2008 3:16 PM

    Do it thru its action:
    //Deactivate a button disabling its action
    //You can see it but clicking it does nothing
    wdGetACTION_NAMEAction().setEnabled(false);
    //Get it's funcionality back
    wdGetACTION_NAMEAction().setEnabled(true);
    Or you could hide it using an attribute of type WDVisibility binded to its visible property.
    //Hide it
    wdContext.currentContextElement.setATTRIBUTE(WDVisibility.NONE);
    //and Show it
    wdContext.currentContextElement.setATTRIBUTE(WDVisibility.VISIBLE);
    Regards.
    Julio Herrera.

  • How to Create a Back button in Flash

    Hi all,
    I need to create a back button for my flash app. It doesn't
    need to be connected with Browser. It just need be able to remember
    what frame they were viewing, and bring them back.
    Is there any event I can use for this? I made an variable
    called "visited:Number" and change it on every frame, but this
    won't work. Once the user enters a new frame, the original visited
    number is replaced by current already. I don't know how to hold
    that number, before they leave the current frame.
    Can anybody give me little clue/direction please?
    Thank you...

    Hi
    I believe that you should look at the Forms functionality for UCM . Under Content Management - Web Form Editor will show up the editor where in you can add buttons and attach functionalities to it . With UCM 11g this is not available thus you might need to use AJAX to build the requirement .
    Thanks
    Srinath

Maybe you are looking for