Some files can harm your computer in SharePoint 2013 (Internet Explorer Only!)

We had the below annoying pop showing up for some users while opening documents within SharePoint 2013.  Surprisingly this issue DOES NOT occur while accessing the same document from a Document Library. But when opening this document from a SharePoint page or a link within a Content Search or Content Query web part the below message pops up.

Some Files Can Harm Your Computer

Following are some of the alternative solutions that were listed in various forums/blogs that might help resolve your issue. But not for me. I have listed the actual solution at the very end.

Solution 1: Add URL to trusted sites.

Add the URL to the trusted sites on Internet Explorer. If this is working for you, you should work with your company to push this as a group policy or something to update for all users. Unfortunately, this did not work for me. I already had the site URL in the trusted sites.

Solution 2: Disable SharePoint OpenDocument Class Add-on for Internet Explorer

Disable SharePoint OpenDocument Class Add-on for Internet Explorer. This works 100%. But we can’t expect every user to do this and has to be pushed via a Group Policy or something. Also, we do not want to deal with consequences of disabling this Add-on. I do not want to go into the details of this Add-On, for now, I will save this as a topic for another blog.

SharePoint OpenDocuments Class

Solution 3: Follow the blog

Solution 4: Add script to suppress calls to Add-on (Worked For me!!)

The following screen capture explains it all. The issue is not occurring within a document library because the ‘onmousedown’ and ‘click‘ events are NOT calling the Add-On see below.

But on the page the link with in Content Query results, the ‘onmousedown’ and ‘click‘ events are calling the Add-On in IE (Internet Explorer).

SharePoint OpenDocuments Class Script



So as a solution we have added a script on to the master page with identifies anchor tags that are pointing to PDF files and replaces text within the two attributes as shown below.

<script type="text/javascript">
var replaceStrings = ["SharePoint.OpenDocuments.3", "SharePoint.OpenDocuments"];
var anchorAttributes = ["onclick", "onmousedown"];
$(document).ready(function () {
$('a[href*="pdf"]').each(function () {
for (var i = 0; i < anchorAttributes.length; i++) {
for (var j = 0; j < replaceStrings.length; j++) {
var value = $(this).attr(anchorAttributes[i]);
if (value) {
$(this).attr(anchorAttributes[i], value.replace(replaceStrings[j], ''));