login/register

Snip!t from collection of Alan Dix

see all channels for Alan Dix

Snip
summary

Despite the tabbed browsing feature, Firefox otherwise i...
There is generally a tag for doing this: autocomplete = ...
Adding it to the input tag: Firefox still autofills!
Removing "address" in lang_main for related input fields ...
... pretty useless

Firefox and its dislike of Autocomplete = "off"
http://www.icyphoenix.com/viewtopic.php?t=514

Categories

/Channels/techie/firefox

[ go to category ]

/Channels/techie/web development

[ go to category ]

For Snip

loading snip actions ...

For Page

loading url actions ...

Despite the tabbed browsing feature, Firefox otherwise is a real pain for many reasons, especially is you are a making a web page. One problem is autocompletion. You might want to make a site more secure/easier to administer by disabling auto-completion regardless of whather the user has it set in their preferenes. An example here is changing a usernames password because they've forgotten their original one. When you go into ACP>>user management, the username and password gets auto-filled by firefox - incredibly annoying! Yes, you can personally go into firefox and change the autofill settings (not by much, you can only delete them - mozilla had a much better system!), but we should be a little more clever and allow autocomplete still to work for some things, and not for others. I have tried, unsuccessfully thus far, to implement this for firefox though. I thought I'd list the ideas here, so that anybody else trying this will know what doesn't work... and maybe somebody might even know the answer!

There is generally a tag for doing this: autocomplete = "off" which you can put inside the form and input tags. Older firefox derivatives, i.e. Mozilla, and Internet explorer, understand this attribute (even though its not W3C standard - not suprising, W3C takes years to do anything, and then cocks it all up). With Firefox, however, the mozdev team decided not to follow this attribute! If I open templates/ca_aphrodite/adm/user_edit_body and change the opening form line to [codeblock]<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post" autocomplete = "off">[codeblock] Firefox still autofills!
Adding it to the input tag: Firefox still autofills!
Removing "address" in lang_main for related input fields (e.g. emial address, AIM address): No result. (See http://developer.mozilla.org/en/doc..._Autocompletion - it gives conditions of where autocomplete="off" fails).

There are some suggestions around for disabling with javascript. E.g. http://forum.java.sun.com/thread.jspa?threadID=755798&tstart=90 suggests:

Code: [Download] [Hide] [Select]
<script language="JavaScript" type="text/javascript">    
function autoCompOff(id)
{
document.getElementById(id).setAttribute("autocomplete","off");
}
</script>



And also from:
http://chrisholland.blogspot.com/20...cy-disable.html

Code: [Download] [Hide] [Select]
<script language="JavaScript" type="text/javascript">
if (document.getElementsByTagName) {
var inputElements = document.getElementsByTagName("input");
for (i=0; inputElements[i]; i++) {
if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) {
inputElements[i].setAttribute("autocomplete","off");
}//if current input element has the disableAutoComplete class set.
}//loop thru input elements
}//basic DOM-happiness-check
</script>


which also requires adding class="disableAutoComplete" to each input field.

These javascript methods are nothing more than a "html mask" - i.e. they still use autocomplete="off", but sets it in javascript to hide it from html validation (for the W3C validator).

As expected, trying these javascript methods in firefox: autofill still works!

This should be a concern not just for phpBBXS, but anybody who is building a site handling protected data - you want to minimise the risk to users accounts by ensuring autocomplete doesn't work, for that risk of users on public machines. Before anyone points it out, yes, Mozdev mention disableAutoComplete for XUL, but this is for themes/user side XML, so in all a pretty useless feature! If anyone knows a work around...

HTML

Despite the tabbed browsing feature, Firefox otherwise is a real pain for many reasons, especially is you are a making a web page. One problem is autocompletion. You might want to make a site more secure/easier to administer by disabling auto-completion regardless of whather the user has it set in their preferenes. An example here is changing a usernames password because they've forgotten their original one. When you go into <acronym title="Admin Control Panel">ACP</acronym>&gt;&gt;user management, the username and password gets auto-filled by firefox - incredibly annoying! Yes, you can personally go into firefox and change the autofill settings (not by much, you can only delete them - mozilla had a much better system!), but we should be a little more clever and allow autocomplete still to work for some things, and not for others. I have tried, unsuccessfully thus far, to implement this for firefox though. I thought I'd list the ideas here, so that anybody else trying this will know what doesn't work... and maybe somebody might even know the answer! <br> <br> There is generally a tag for doing this: autocomplete = "off" which you can put inside the form and input tags. Older firefox derivatives, i.e. Mozilla, and <a style="background: transparent url(http://files.adbrite.com/mb/images/green-double-underline-006600.gif) repeat-x scroll center bottom; cursor: pointer; color: rgb(0, 102, 0); text-decoration: none; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-bottom: -2px; padding-bottom: 2px;" name="AdBriteInlineAd_internet" id="AdBriteInlineAd_internet" target="_top">Internet</a> explorer, understand this attribute (even though its not W3C standard - not suprising, W3C takes years to do anything, and then cocks it all up). With Firefox, however, the mozdev team decided not to follow this attribute! If I open templates/ca_aphrodite/adm/user_edit_body and change the opening form line to [codeblock]&lt;form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post" autocomplete = "off"&gt;[codeblock] Firefox still autofills! <br> Adding it to the input tag: Firefox still autofills! <br> Removing "address" in lang_main for related input fields (e.g. emial address, AIM address): No result. (See <a class="post-url" href="http://developer.mozilla.org/en/docs/How_to_Turn_Off_Form_Autocompletion" target="_blank">http://developer.mozilla.org/en/doc..._Autocompletion</a> - it gives conditions of where autocomplete="off" fails). <br> <br> There are some suggestions around for disabling with javascript. E.g. <a class="post-url" href="http://forum.java.sun.com/thread.jspa?threadID=755798&amp;tstart=90" target="_blank">http://forum.java.sun.com/thread.jspa?threadID=755798&amp;tstart=90</a> suggests: <br> <br> <!-- no smilies start --><div class="code"><div class="code-header" id="codehdr2_ee49c274" style="position: relative;">Code: [<a href="download_post.php?post=4033">Download</a>] [<a href="javascript:void(0)" onclick="ShowHide('code_ee49c274','code2_ee49c274','');ShowHide('codehdr_ee49c274','codehdr2_ee49c274','')">Hide</a>] [<a href="javascript:void(0)" onclick="select_text('code_ee49c274')">Select</a>]</div><div class="code-header" id="codehdr_ee49c274" style="position: relative; display: none;">Code: [<a href="download_post.php?post=4033">Download</a>] [<a href="javascript:void(0)" onclick="ShowHide('code_ee49c274','code2_ee49c274',''); ShowHide('codehdr_ee49c274','codehdr2_ee49c274','')">Show</a>]</div><div class="code-content" id="code_ee49c274" style="position: relative;"><span class="code-row-text">&lt;script language="JavaScript" type="text/javascript"&gt; &nbsp; &nbsp; <br> function autoCompOff(id) <br> { <br> document.getElementById(id).setAttribute("autocomplete","off"); <br> } <br> &lt;/script&gt;</span></div></div><!-- no smilies end --> <br> <br> <br> And also from: <br> <a class="post-url" href="http://chrisholland.blogspot.com/2004/11/banks-protect-privacy-disable.html" target="_blank">http://chrisholland.blogspot.com/20...cy-disable.html</a> <br> <br> <!-- no smilies start --><div class="code"><div class="code-header" id="codehdr2_bb7d9be7" style="position: relative;">Code: [<a href="download_post.php?post=4033&amp;item=1">Download</a>] [<a href="javascript:void(0)" onclick="ShowHide('code_bb7d9be7','code2_bb7d9be7','');ShowHide('codehdr_bb7d9be7','codehdr2_bb7d9be7','')">Hide</a>] [<a href="javascript:void(0)" onclick="select_text('code_bb7d9be7')">Select</a>]</div><div class="code-header" id="codehdr_bb7d9be7" style="position: relative; display: none;">Code: [<a href="download_post.php?post=4033&amp;item=1">Download</a>] [<a href="javascript:void(0)" onclick="ShowHide('code_bb7d9be7','code2_bb7d9be7',''); ShowHide('codehdr_bb7d9be7','codehdr2_bb7d9be7','')">Show</a>]</div><div class="code-content" id="code_bb7d9be7" style="position: relative;"><span class="code-row-text">&lt;script language="JavaScript" type="text/javascript"&gt; <br> if (document.getElementsByTagName) { <br> var inputElements = document.getElementsByTagName("input"); <br> for (i=0; inputElements[i]; i++) { <br> if (inputElements[i].className &amp;&amp; (inputElements[i].className.indexOf("disableAutoComplete") != -1)) { <br> inputElements[i].setAttribute("autocomplete","off"); <br> }//if current input element has the disableAutoComplete class set. <br> }//loop thru input elements <br> }//basic DOM-happiness-check <br> &lt;/script&gt;</span></div></div><!-- no smilies end --> <br> <br> which also requires adding class="disableAutoComplete" to each input field. <br> <br> These javascript methods are nothing more than a "html mask" - i.e. they still use autocomplete="off", but sets it in javascript to hide it from html validation (for the W3C validator). <br> <br> As expected, trying these javascript methods in firefox: autofill still works! <br> <br> This should be a concern not just for <acronym title="Icy Phoenix Ancestor">phpBBXS</acronym>, but anybody who is building a site handling protected data - you want to minimise the risk to users accounts by ensuring autocomplete doesn't work, for that risk of users on public machines. Before anyone points it out, yes, Mozdev mention disableAutoComplete for XUL, but this is for themes/user side XML, so in all a pretty useless feature! If anyone knows a work around...