basirana
asked on
Disable events
Hi
I have 3 important questions.
1. How to disable back button in the browser? User should not go back by clicking back button in the browser.
2. How to disable view source in the browser?
3. how to disable disable mouse right click?
Please help me with sample code.
Thanks
I have 3 important questions.
1. How to disable back button in the browser? User should not go back by clicking back button in the browser.
2. How to disable view source in the browser?
3. how to disable disable mouse right click?
Please help me with sample code.
Thanks
More to the point: If the page is on the internet, you can do NOTHING to stop it from being saved, viewed, copied.
I can turn off javascript
I can view generated html in Firefox
I can look in my cache
I can do view-source:http://yoursite.com/yourpage.html or just use a plugin for firefox to do it for me
You may want to tell us what you are trying to achieve instead of trying to block people from seeing your site.
<a href="page.html" onClick="location.replace( this.href) ; return false">Replace current page</a>
will for example show a new page and not disable the back button but simply remove the page from history.
this is again possible to bypass by turning JS off.
Michel
I can turn off javascript
I can view generated html in Firefox
I can look in my cache
I can do view-source:http://yoursite.com/yourpage.html or just use a plugin for firefox to do it for me
You may want to tell us what you are trying to achieve instead of trying to block people from seeing your site.
<a href="page.html" onClick="location.replace(
will for example show a new page and not disable the back button but simply remove the page from history.
this is again possible to bypass by turning JS off.
Michel
ASKER
I want to create a secure code so that the parameter names... they should be able to navigate forward but the back should be deabled.
There are some hidden parameters they should not be seen by users.
I want to implement some sort of security to my page.
Thanks
There are some hidden parameters they should not be seen by users.
I want to implement some sort of security to my page.
Thanks
Expire your cache that is the best thing you can do to avoid back and forward
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
please never use the onLoad=history code since it BREAKS the back button instead of disable the previous page. location.replace is much gentler and more effective. to hide data, encrypt it instead. if it is important enough, people WILL decrypt it though.
For 3 try this code:
<html>
<head>
<title>Script Demo</title>
<script language="JavaScript">
<!--
function inIE(){
if (event.button==2){
return false;
}
}
function inNS(e){
if (document.layers||document
if (e.which==2||e.which==3){
return false;
}
}
}
if (document.layers){
document.captureEvents(Eve
document.onmousedown=inNS;
}
else if (document.all&&!document.g
document.onmousedown=inIE;
}
document.oncontextmenu=new
// -->
</script>
</head>
<body>
</body>
</html>