Disabled Back n Forward

[Total: 0    Average: 0/5]

Here is an example to disable back button and forward button.

Head Code:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 


<SCRIPT LANGUAGE="JavaScript"> 
var xyz=1; 
var done =1; 

function gohis(){ 
if( xyz && done ){ 
window.location.href="http://www.google.com"; 
done = 0; 
} 
} 
function init()
{
  var _p ="";
      _p+="<HTML><head><META HTTP-EQUIV="Pragma" CONTENT="no-cache"></head>";
	  _p+="<body onclick="javascript:top.xyz=0" onload="javascript:top.xyz=1" onunload="javascript:top.gohis()">";
	  _p+="<h1> Page A </h1><a href="/">click here </a></body></HTML>"; 
  self.tp.document.open();
  self.tp.document.write(_p);
  self.tp.document.close();
  var _q ="";
      _q+="<HTML><head><META HTTP-EQUIV="Pragma" CONTENT="no-cache"></head>";
	  _q+="<body onclick="javascript:top.xyz=0" onload="javascript:top.xyz=1" onunload="javascript:top.gohis()">";
	  _q+="<h1> Page B </h1><a href="/">click here </a></body></HTML>"; 
  self.bt.document.open();
  self.bt.document.write(_q);
  self.bt.document.close();
}
setTimeout("init()",300); /* wait 1/3 second, then load up the pages */
</SCRIPT>


</head> 

<frameset cols="50%,50%" onunload="gohis()"> 
<frame name="tp"> 
<frame name="bt"> 
</frameset> <!--

Body Code:

There is no body code.

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *