Do browsers support autocomplete for ajax loaded login forms at all? Do browsers support autocomplete for ajax loaded login forms at all? php php

Do browsers support autocomplete for ajax loaded login forms at all?


Autocomplete, in Firefox at least, triggers during page load. Adding the content afterwards would miss the window of opportunity.

A login form is tiny. I'd include it in the page from the outset and consider hiding it with CSS until it is wanted.


In case it helps, msdn says (towards the bottom of the page):

Note: if both of the following conditions are true:

  • The page was delivered over HTTPS
  • The page was delivered with headers or a META tag that prevents caching

...the Autocomplete feature is disabled, regardless of the existence or value of the Autocomplete attribute. This remark applies to IE5, IE6, IE7, and IE8.

I've emboldened the interesting bit.

.


I don't think you can get the form autocomplete to work if you load the form via ajax (security-wise I don't know if it can be really be abused or not, but the fact that a script could start loading fields into the page to see what data gets inserted doesn't look too good to me).

If you can, the best option would be to add a conditional block to the php file and include the form or not depending on whether the user is logged or not. If for some reason you can't do that, you might want to try to do a document.write() instead of the ajax call (and yes, using document.write is ugly :)