Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

You can have different HTML input elements on a single HTML form and all of them, have their associated remembered values (values that you've entered in those fields); Is it related to the id or name attribute of the input element? No. Proof? Your email address appears on many input elements across different websites, and all those fields have different id and name attributes.

So, there is a mystery here I don't understand. How browsers remember values for HTML form controls? What is the algorithm? How they know that they should show your email on this control and not on that control, while controls are both HTML input type=text elements?

share|improve this question
    
It is related to the name attribute. –  Rein Henrichs Oct 26 '11 at 7:46
    
Close voter, would you mind please telling us why? Is it an off-topic question? Is it not constructive? What is the reason to vote for closing? –  Saeed Neamati Oct 26 '11 at 7:53

2 Answers 2

Browser are checking for similarity between input elements' name attributes. Also, there are standard names for input fields defined in RFC 3106. Also look here.

share|improve this answer

Different browsers use different algorithms. I know if I were building one I would wind up

  • checking if the fields name/id has 'email' in it
  • checking if the label text has 'email' in it
  • checking for common abbreviations
  • (if I were google) keeping track of all the forms everyone inputs and seeing which ones get email address looking strings put in them. Since I'm google I can totally do that ;).
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.