Sell And Buy

Monday, 9 November 2015

Open A New Window without Back Button using javascript

Following is the code to open webpage in a new window have no toolbar (Back/Next buttons). ("",

Disable the right click on any webpage using Javascript

<body oncontextmenu="return false;">  

Disable Back functionality using history.forward


<SCRIPT type="text/javascript">
    function noBack() { window.history.forward(); }
<BODY onload="noBack();"
    onpageshow="if (event.persisted) noBack();" onunload="">

Warn User if Back is Pressed


Following Javascript snippet will add a warning message in case Back button is pressed:
window.onbeforeunload = function() { return "You work will be lost."; };