skip to Main Content

My application has a search textfield, and I’d like to offer a autocomplete/autosuggest functionality, preferably without rolling my own.

The input type="search" element appears to suit my purposes.

<input type="search" placeholder="search" name="q"/>

For me, the above input will provide auto complete suggests that appear to come from Github.

enter image description here

Though I believe that’s because it share the name property with Github’s issue search, Github’s issue search element is:

<input 
   type="text" 
   name="q" 
   id="js-issues-search" 
   value="is:issue is:open " 
   class="form-control form-control subnav-search-input input-contrast width-full" 
   placeholder="Search all issues" 
   aria-label="Search all issues" 
   data-hotkey="Control+/,Meta+/">

The concern is – I don’t want searches from other websites polluting mine, nor do I want searches from my website polluting others.

How can instruct the browser to constrain the autocomplete to this website only?

I suppose I could put a unique looking name attribute in, but is there a better way?

2

Answers


  1. put autocomplete="off" in your input. This property should turn off the auto complete feature for users.

    Login or Signup to reply.
  2. according to the official HTML Standard, autocomplete values are on,off or a <token-list>. I guess that according to what info you want to be auto-completed, you have to provide a list of tokens.

    for concrete, examples check the standard

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search