Howto disable autocomplete for an entire SharePoint farm

This article has been archived. It is offered "as is" and will no longer be updated.
Source: Microsoft Support
RAPID PUBLISHING
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
Symptom


Some 3rd party security applications will flag the built in AutoComplete SharePoint functionality as a security risk when users access the SharePoint resources on a public machine.
Cause
Resolution


Recommendations include setting autocomplete to "off" on all your forms. 

Or, writing some custom code to override the feature.

 

Here is some SAMPLE CODE that can be used in conjunction with a client created custom.js to override the Autocomplete feature in SharePoint:

 

1.     Create feature files that will inject content into the master page "AdditionalPageHead" section.

 

2.     Create a new feature folder under SharePoint. Add the Feature.xml and CustomSchema.xml files like below:

 

 

TEMPLATE\FEATURES\DelegateControl\feature.xml

Feature.xml
===================
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="<GUID>"
Title = "AUTOCOMPLETE Disable"
Description = "AUTOCOMPLETE Disable"
Creator = "creatorName"
Version = "1.0.0.0"
DefaultResourceFile=" "
Hidden ="TRUE"
Scope="WebApplication"
xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="CustomSchema.xml" />
  </ElementManifests>
</Feature>



CustomSchema.xml
=====================
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="AdditionalPageHead"
  Sequence="80"
  ControlSrc="~/_controltemplates/custom/custom.ascx">
  </Control>
</Elements>

2. Create a custom.ascx file and place it in the TEMPLATE\CONTROLTEMPLATES\custom\ directory of the 12 hive

Custom.ascx
====================
<%@ Control Language="C#" %>
<script type="text/javascript"
src="/_layouts/Custom/Custom.js" defer="true"></script>

3. Create your custom.js and place it in the Layouts/Custom/ directory of the 12 hive

Custom.js
====================
if (document.getElementsByTagName) {
  var forms = document.getElementsByTagName("form");
  for (var i=0; i<forms.length; i++) {
    forms[i].autocomplete = "off";
  }
}
More Information


Feature Element (Feature) http://msdn.microsoft.com/en-us/library/ms436075.aspx
DISCLAIMER
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 970782 - Last Review: 01/15/2015 11:06:57 - Revision: 2.0

  • Microsoft Windows SharePoint Services 3.0
  • Microsoft Office SharePoint Server 2007
  • kbnosurvey kbarchive kbrapidpub kbnomt KB970782
Feedback