A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/how-to-turn-on-off-form-autocompletion-in-html/ below:

How to turn on/off form autocompletion in HTML ?

How to turn on/off form autocompletion in HTML ?

Last Updated : 05 May, 2025

All the browsers by default remember information that the user submits through fields on websites. It enables the browser to offer auto-completion. This feature is usually enabled by default, but it can be a privacy concern for users, so browsers can let users disable them. But it is essential to know that if you want to create a website where you are getting information about the user's name, age, and email_id, etc that is by the browsers by default. If you disable the autocomplete in your site then you are breaking the rules. It is illegal to set autocomplete="off". The autocomplete is set to off maybe secure for the user but it is against the rules.
But for the testing and knowledge to disable auto-completion in forms, you can set the autocomplete attribute to "off":

Syntax:  

autocomplete="on/off"

Setting autocomplete="off" on fields has two effects:  

Example: This example illustrates the above approach.

HTML
<!DOCTYPE html> 
<html> 
  
<head> 
    <title>Autocomplete on/off</title> 
  
    <style> 
        h1 { 
            color: green; 
        } 
    </style> 
</head> 
  
<body style="text-align:center;"> 
      
    <h1 style="color:green;"> 
        GeeksforGeeks 
    </h1> 
      
    <h4>Autocomplete on/off</h4> 
      
    <form action="https://www.geeksforgeeks.org/community/"
                    autocomplete="on"> 
        First name: <input type="text" name="fname"> 
          
        <br><br>  
          
        Last name: <input type="text" name="lname"> 
          
        <br><br>  
          
        Email_id: <input type="email" name="email"
                    autocomplete="off"> 
          
        <br><br> 
          
        <input type="submit"> 
    </form> 
      
    
<p> 
        <b>Note:</b> autocomplete is "on" for the 
        form, but "off" for the e-mail field. 
    </p>
 
</body> 
  
</html> 

Note: In addition to autocomplete="off", you could also have your form field names be randomized by the code that generates the page, perhaps by adding some session-specific string to the end of the names.
 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4