how to disable browser back button

how to disable browser back button

Am doing a web application in that how to disable browser back button using java script?

View Answers

June 1, 2011 at 11:52 PM

Hi Ravi,

To disable back button of your browser, place the below script in the header section( ) of your jsp/html page.

<script type="text/javascript">

function disableBackButton()
 {
  //location.href("logout.html");

 }
if(window.history.forward(1) != null)
         window.history.forward(1);
</script>

After that you can call the method "disableBackButton()" where ever you want in your page as shown below:

<a href="logout.jsp" onClick="cl();" >Logout</a>

Hope this will help.

Thanks & regards, Sarath Kumar Sivan


June 2, 2011 at 12:05 AM

<script>
if(window.history.forward(1) != null)
                 window.history.forward(1);
</script>









Related Tutorials/Questions & Answers:
how to disable browser back button
how to disable browser back button  Am doing a web application in that how to disable browser back button using java script
code to disable back button of browser
code to disable back button of browser  code to disable back button of browser
Advertisements
code to disable back button of browser
code to disable back button of browser  code to disable back button of browser
how to disable back button of a browser after logging in? - JSP-Servlet
how to disable back button of a browser after logging in?  how to disable back button of a browser after logging in?  where is the source code
How to disable browser back and forward button after logout [in struts2 or jsp]
How to disable browser back and forward button after logout [in struts2 or jsp]  How to disable browser back and forward button after logout... click the back button of the browser more than one time
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
How to disable back button in browser using javascript
that will disable the working of Back button in Browser:ADS_TO_REPLACE_1 <...There are times while developing a website, we need to disable back button... of the time the back button is disabled because a user can hit back
Browser Back Button Disable/Hide/Invisible using Java Script
Browser Back Button Disable/Hide/Invisible using Java Script  Dear Sir, Please Help..., Q: How to Write Code For Browser Back Button Disable/Hide/Invisible using Java Script without Page Reload/Refreshing. anyone
How to disable browser back after logout - JSP-Servlet
. Anyone having idea how to disable browser back button after logout, please...How to disable browser back after logout  Dear All I created JSP... problem is, when i am clicking browser back button i can see my old visited pages
Enable Browser's back button
Enable Browser's back button  how to redirect to a home page when browser's back button is pressed in jsp instead of displaying the previous page
Browser's back button
Browser's back button  how to redirect to a home page when browser's back button is pressed in jsp instead of displaying the previous page
Browser's back button
Browser's back button  how to redirect to a home page when browser's back button is pressed in jsp instead of displaying the previous page
How to disable browser back after logout - JSP-Servlet
How to disable browser back after logout  thanks deepak, i tried but if i am clicking back still i can see my old pages. i copied your code in my logout page. please if you have any other solution, please give me
browser back button
browser back button   hi...i created one page in JSF.that page had three form division.in first form one add button is there.if i click that button move to second form,then i click browser back button ,it moves on another page.so
disable back button - Java Beginners
disable back button  I wanted the code for disabling back button... displayed but..when i click back button i go back to the register page which should be avoided) I saw methods like using location.replace() but not sure how to use
disabling the browser's back button
disabling the browser's back button  I have following requirement, After submitting the form, user should not navigate to the previous page. I have tried with onbeforeunload(), but it is not working properly. Please help me
Browser Back Button click event javascript
Browser Back Button click event javascript  I am using the below code but window.onBeforeUnload is not working with back button.. how can i apply the below code for the click event of back button? window.onBeforeUnload
how to disable submit button after login in jsp
on the back button in browser it stars displaying login page. How to prevent this? how to disable submit button after login in jsp? Thanks   Hi, You can...how to disable submit button after login in jsp  Hi, I have
Back button
Back button  how to redirect to a home page when a back button is pressed in jsp instead of displaying the previous page
disabling back button
press back button i again reach to the back page ie. authentication page so if any one can help me how to disable this button...disabling back button  hi, i am trying to make an application and i
back button issue - Java Beginners
of problem there is two solutions 1- you can disable the back button...back button issue  Hello, I have a site that asks for user... pushs the back button of the explorator he can entry in the page of first user
navigation item back button
navigation item back button  I wants to add a navigationBar on the top of my UIWebView also a navigation item "back button". can anyone please explain how the back and refresh button works
Browser Back/Forward - Struts
Browser Back/Forward  Hi, Greetings to all. I have developed a web application using Struts 2. Now, i want to enable browser back/forward/bookmarking in that. Can anyone post me some links/tutorial/examples or how to go
Disabling the back button in all the browsers
Disabling the back button in all the browsers  I have a requirement like this, I have to disable back button of all the browsers(It should support all the browsers). Can u plz help me
uinavigationcontroller back button action
uinavigationcontroller back button action  Hi, Tell me how to back... will display the back view on click of a button in my iPhone and iPad based application. Give me any code for uinavigationcontroller back button action method. Thanks
PushViewController back button
PushViewController back button  How can i hide the back button... it always show back button.   In your ViewDidLoad method just hide the navigation back button as given in the code. navigationItem.hidesBackButton = YES
how to disable submit button in jsp using servlet when some condition is satisfied
how to disable submit button in jsp using servlet when some condition is satisfied  how to disable submit button in jsp using servlet when some condition is satisfied
Disable offline browser access - Security
Disable offline browser access    Hi Please help me to solve... the offline browser issue for the security purpose. But so far I don't find any solution. What I needed is; When the user clicks the website from the browser
back button in jquery
back button in jquery  Creating a back button in JQuery   <script src="/javascript/jquery.min.js"></script> <script type="text/javascript">     $(document).bind("mobileinit", function(){     
How to prevent from navigating to a page after reaching Login page using back button?
login page using back button and agin click browser forward button,the 2nd page...How to prevent from navigating to a page after reaching Login page using back button?  Hi sir, I have created 2 pages, 1) Lo gin Page 2)Page
How to prevent from navigating to ck buttonnext page when user reaches login page using back button
goback to user login page using back button and agin click browser forward button...How to prevent from navigating to ck buttonnext page when user reaches login page using back button  Hi sir, I have created 2 pages, 1) Lo gin Page
JSP Back Button
JSP Back Button          Jsp Back Button enables the user back... The Tutorial illustrate an example from 'JSP Back Button'. To understand
uinavigationcontroller back button not showing/ missing
uinavigationcontroller back button not showing/ missing  Hi, In my... but ... somehow in the next view uinavigationcontroller back button not showing...... as the uinavigationbar back button use the title of the previous view
How to disable an HTML object?
How to disable an HTML object?  How to disable an HTML object
Session expire and back button in jsp and servlet .
previous pages by clicking back button of browser without again logging. Plz... Session expire and back button in jsp and servlet .  Hii Sir, I have to make a login and logout page with sessions .Now i have
ModuleNotFoundError: No module named 'odoo10-addon-stock-disable-force-availability-button'
-availability-button' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-stock-disable-force-availability-button' error? Thanks.... You can install odoo10-addon-stock-disable-force-availability-button python
ModuleNotFoundError: No module named 'odoo8-addon-mrp-disable-force-availability-button'
-button' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-mrp-disable-force-availability-button' error? Thanks  ... install odoo8-addon-mrp-disable-force-availability-button python with following
ModuleNotFoundError: No module named 'odoo8-addon-mrp-disable-force-availability-button'
-button' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-mrp-disable-force-availability-button' error? Thanks  ... install odoo8-addon-mrp-disable-force-availability-button python with following
ModuleNotFoundError: No module named 'odoo8-addon-stock-disable-force-availability-button'
-availability-button' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-stock-disable-force-availability-button' error? Thanks ... can install odoo8-addon-stock-disable-force-availability-button python
ModuleNotFoundError: No module named 'odoo8-addon-stock-disable-force-availability-button'
-availability-button' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-stock-disable-force-availability-button' error? Thanks ... can install odoo8-addon-stock-disable-force-availability-button python
ModuleNotFoundError: No module named 'odoo9-addon-mrp-disable-force-availability-button'
-button' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-mrp-disable-force-availability-button' error? Thanks  ... install odoo9-addon-mrp-disable-force-availability-button python with following
ModuleNotFoundError: No module named 'odoo9-addon-stock-disable-force-availability-button'
-availability-button' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-stock-disable-force-availability-button' error? Thanks ... can install odoo9-addon-stock-disable-force-availability-button python
Should not logout after clicking the back/forward button
he clicks on the back button user automatically gets logged out. very next if clicked the forward button user gets logged in..!! how can I solve this issue? What...Should not logout after clicking the back/forward button  Hi all I
click on back button go to the login page
click on back button go to the login page  now when i click on back button the page show that page on where i came from and it shows the session expired but i want when i click a back buttob then it should show a login page
After Logout Back Button Should not work again
After Logout Back Button Should not work again  Hi deepak,, I am doing Login Page,.. IN That If Logout Then When I Click Logout Button It Should...")!= null){ //then show the logout button }else{ // show the login button
How to disable task manager using java
How to disable task manager using java  How to disable task manager using java
How to Disable Catch-all Emails on CPanel
How to Disable Catch-all Emails on CPanel  Hi, How to disable catch all emails setting on CPanel? Thanks
forwarding request to a jsp when user clicks on back button in ie
forwarding request to a jsp when user clicks on back button in ie  Hi... of the application, We should not allow the customer to go back to the previous page. Can we forward request to a jsp page whenever user clicks on back button
how to make enable/disable textbox in while(rs.next)
how to make enable/disable textbox in while(rs.next)  Hi, I'm trying to enable/disable the textbox in the while loop. It works but when i want.../disable function,the data are updated correctly. Is my javascript wrong? How do i

Ads