kousis
asked on
Disable back button in Browser
hi,
I need to disable the back button in browswer for security. Is it possible.. please guide me
TIA
I need to disable the back button in browswer for security. Is it possible.. please guide me
TIA
It is not possible to do that.
Read this for some workarounds of it.
http://www.4guysfromrolla.com/webtech/111500-1.shtml
http://www.4guysfromrolla.com/webtech/111500-1.2.shtml
hongjun
Read this for some workarounds of it.
http://www.4guysfromrolla.com/webtech/111500-1.shtml
http://www.4guysfromrolla.com/webtech/111500-1.2.shtml
hongjun
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can't do it directly, but her's a work around:
<SCRIPT LANGUAGE=javascript>
{
var Backlen=history.length;
history.go(-Backlen);
top.window.location.href ="YourPage.asp";
}
</SCRIPT>
or this:
<body OnLoad="window.history.for ward();">
this way you disable the ability to move backwards.
<SCRIPT LANGUAGE=javascript>
{
var Backlen=history.length;
history.go(-Backlen);
top.window.location.href ="YourPage.asp";
}
</SCRIPT>
or this:
<body OnLoad="window.history.for
this way you disable the ability to move backwards.
In conclusion, you cannot really disable the back button. You just have to resort to using workarounds. Combine mine and Silvers5's and you will get what you wanted.
hongjun
hongjun
<script language="JavaScript">
<!--
javascript:window.history. forward(1) ;
//-->
</script>
<!--
javascript:window.history.
//-->
</script>
pack,
What is the difference between your
<script language="JavaScript">
<!--
javascript:window.history. forward(1) ;
//-->
</script>
and Silvers5's
<body OnLoad="window.history.for ward();">
hongjun
What is the difference between your
<script language="JavaScript">
<!--
javascript:window.history.
//-->
</script>
and Silvers5's
<body OnLoad="window.history.for
hongjun
kousis,
please reject pack's answer and consider mine or Silvers5's.
hongjun
please reject pack's answer and consider mine or Silvers5's.
hongjun
or split for both
OK
But first of all the questionner got to reply.
hongjun
hongjun
ASKER
while using location.replace() page is getting refreshed for each sec. i don't know where the problem is. could u pls suggest me
Why don't you use document.replace instead? First of all, reject his answer.
hongjun
hongjun
ASKER
while using location.replace() page is getting refreshed for each sec. i don't know where the problem is. could u pls suggest me
Pack - since you're new to Experts-Exchange I would suggest you carefully read through the section regarding questions and answering questions here : https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp
In brief. Do not post your comment as an answer unless it completely provides a solution to the person posting the question and that it has NOT already been suggested by another user as a comment.
Ideally all users should only post comments as it allows the person who posted the question to select the correct person for points awarding. This also keeps the question in the un-answered questions section so that other experts can see it and post a reply. Otherwise it gets moved to the Locked questions section.
In answer to your question pretty much everyone has given the same answer as there is no way of really "disabling" the back button except for resorting to work-arounds. If you don't want users to use browser navigation other than that which you provide on your site then I'd suggest opening your site in a toolbar-less window as well as disabling the right click. Then you MUST however make sure that your navigation is 100% adequate and easy to use.
Regards,
CyberSoft
In brief. Do not post your comment as an answer unless it completely provides a solution to the person posting the question and that it has NOT already been suggested by another user as a comment.
Ideally all users should only post comments as it allows the person who posted the question to select the correct person for points awarding. This also keeps the question in the un-answered questions section so that other experts can see it and post a reply. Otherwise it gets moved to the Locked questions section.
In answer to your question pretty much everyone has given the same answer as there is no way of really "disabling" the back button except for resorting to work-arounds. If you don't want users to use browser navigation other than that which you provide on your site then I'd suggest opening your site in a toolbar-less window as well as disabling the right click. Then you MUST however make sure that your navigation is 100% adequate and easy to use.
Regards,
CyberSoft
pack I am rejecting your answer as it duplicates comments proposed by other members.
Lunchy
Friendly Neighbourhood Community Support Moderator
Lunchy
Friendly Neighbourhood Community Support Moderator
ASKER
document.replace() is giving runtime error
"object doesn't support this property"
"object doesn't support this property"
Should be location.replace('filename .html') NOT document.replace('filename .html')
Regards,
CyberSoft
Regards,
CyberSoft
Try
window.replace("index.html ");
hongjun
window.replace("index.html
hongjun
ASKER
like rumblefiz suggested, i am giving this window.replace in head, but it's printing the page which i am specified in the url first not the page which i gave in the <body>
so suggest where i ahve to use the code.
TIA
so suggest where i ahve to use the code.
TIA
Try this
first_page.asp
=============
Click <a href=javascript:window.rep lace("seco nd_page.as p")>here</ a>
hongjun
first_page.asp
=============
Click <a href=javascript:window.rep
hongjun
ASKER
It is working while i am giving it in onClick()
In my case.
I got 2 frames
in one frame i have logout option. After clicking the logout option it goes to main screen then if i click back in the browser it goes to the prevoius page which i don't want to. I want to redirect to some other page.
Hope u understand my query and clear my doubt
TIA
In my case.
I got 2 frames
in one frame i have logout option. After clicking the logout option it goes to main screen then if i click back in the browser it goes to the prevoius page which i don't want to. I want to redirect to some other page.
Hope u understand my query and clear my doubt
TIA
<ping>
ASKER
Lunchy
what is that mean?
what is that mean?
Sorry kousis, I didn't realize I was getting notifications on this question so I posted a ping comment to make sure I was getting them.
try
document.location.replace( "url")
document.location.replace(
kousis,
Every question you have ever asked is still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11039425
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20177400
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20163586
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20163383
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20134855
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11808378
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20130338
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20108322
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11809519
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20007642
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11857019
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11856898
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11856518
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11781498
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11723119
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Every question you have ever asked is still open. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11039425
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20177400
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20163586
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20163383
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20134855
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11808378
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20130338
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20108322
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11809519
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20007642
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11857019
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11856898
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11856518
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11781498
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11723119
Thanks,
Netminder
Community Support Moderator
Experts Exchange
any progresses?
hongjun
hongjun
page1.htm
<html>
<head>
<title>Page 1</title>
<script language="javascript">
location.replace("/index.h
</script>
</head>
<body>
All your other stuff
</body>
</html>
now when someone loads page1.htm for the first time, they will see whatever you have in the body. when they submit or go to another page, when they press the back button, index.html will load instead. this does not make the entry in the history list disappear if you click on go | etc... but it does replace the doc with the one you specify. if you dont specify one, i think it may just remove it and they will go back to the page they were on before they loaded page1.html.
this worked for me and it may work for you. may not though.
- rumblefiz