Consider the login HTML page :
<%@ page language="java"
contentType="text/html; charset=windows-1256"
pageEncoding="windows-1256"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Bank application</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
<link rel="stylesheet"
href="./css/forgotPass.css"
type="text/css"/>
</head>
<body>
<table class="title">
<tr><th>Web Bank application</th></tr>
</table>
<br/>
<!-- JS Code to make sure that the user MUST enter something in the login page -->
<script>
function verifyEmptyString()
{
var username = document.forms["loginForm"]["username"].value;
var password = document.forms["loginForm"]["password"].value;
if (username == null || username == '' || password == null || password == '')
{
alert("Both Username and Password are required !");
return false;
}
return true;
}
</script>
<fieldset>
<legend>Login Page - please enter your Username and Password</legend>
<form onsubmit="return verifyEmptyString(this)" id="loginForm" action="loginPage" method="post" >
<!-- note we use here a paragraph & font size -->
<!-- Notice we use a Required field !!! -->
<p style="font-size:15px"><span style="color:red;font-weight:bold;">*</span> Username: <input type="text" name="username" value="" ><br> </p>
<p style="font-size:15px"><span style="color:red;font-weight:bold;">*</span> Password : <input type="password" name="password"><br> </p>
<input type="submit" value="Login">
<br> <br>
<a href="#" class="myButton">Forgot your password ?</a>
</form>
</fieldset>
<br/>
<br/>
<br/>
<br/>
<br/><br/><br/><br/><br/><br/>
</body></html>
The textfield of Username
is always cached.
When I use :
<input type="text" name="Username" autocomplete="off">
Then I get : Undefined attribute name (autocomplete) .
And that's also not supported in all the browsers .
How can I force completely the textfield from not remembering the previous values that were entered , in all the browsers ?
Add this to your HTML :
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.