- 右クリック
- 戻るボタン
- F5
あたりが抑止される対象だと思う。
まあ、ブラウザの機能を抑止するWebページってどうなんだ、
という議論は置いておいて。
(業務システムだとか、そういう場合かな)
またもや、jqueryを用いて抑止してみた。
一応、以下の場所ではBackspaceを許可。
- <input type="text">
- <input type="password">
- <textarea></textarea>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<title> .:: Sample Play Keepaway ::. Prohibit-01</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="cache-control" content="no-cache">
<meta name="Author" content="Sample">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<link rel="stylesheet" href="css/blue/style.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="css/default.css" type="text/css" />
- <script language="Javascript" type="text/javascript" charset="UTF-8" src="js/lib/jquery-1.3.2.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- // 戻るの禁止
- $(document).keydown(function(event){
- if (event.altKey && event.keyCode == 37) {
- return false;
- } else if (event.keyCode == 8) {
- if (event.srcElement.type != undefined &&
- (event.srcElement.type == 'text' ||
- event.srcElement.type == 'password' ||
- event.srcElement.type == 'textarea')) {
- return true;
- } else {
- return false;
- }
- } else {
- return true;
- }
- });
- // 右クリックの禁止
- $(document).bind("contextmenu",function(e){
- return false;
- });
- });
- </script>
</head>
<body>
<h2>最初のページ</h2>
<div>
テキストボックス:<input type="text" name="sampleText" id="sampleText" size="20" value="さんぷるてきすと">
<br>
パスワードボックス:<input type="password" name="samplePassword" id="samplePassword" size="10" value="">
<br>
テキストエリア:<textarea name="sampleArea" id="sampleArea" rows="10" cols="20">ああああああああああああああああああああああああ
いいいいいいいいいいいいいいいいいいいい
</textarea>
<a href="./sample2.html">次のページへ</a>
</div>
</div>
</body>
</html>