Type Mismatch on wpadder.js

I encountered an odd error today working on a SharePoint 2010 Publishing site. After adding all my usual scripts, I was no longer able to use any Web Part adding functionality. Clicking “add a web part” in the web part zones did nothing. Trying to insert a webpart via the ribbon brought up the web part adder, but the majority of it was blank and just kinda busted.

I did however get this error

SCRIPT5: Type mismatch.
wpadder.js?rev=hnGJJEMcU5XH%2BCq7PlSxJw%3D%3D, line 2 character 13993

in the IE debugger under the Script tab error console.


Sharepoint (and possibly IE in general) has issues with any plugins/scripts that try to extend the Array Prototype. It appears that it breaks quite a few functions and generally is a good idea not to extend it if you dont have to.

So, to wrap it up. If you run into this problem, search through all your javascript for the string “Array.prototype”, or even “Array.” and you should come up with a hit (hopefully), comment that out or find a workaround for that piece of code and you’re good to go


We (mainly Adam Toth) found that less.js also causes an issue, due to the fact that it redefines all the prototype functions for Arrays. The same root problem, but it was a bit tricker to find. Make sure to do a full-text search on your entire project for the best results. I like Astrogrep to do this. It’s fast, thorough, and free.

More Offenders

Thanks to Bryan Gulley


  1. Murali Arumugam says:

    Thanks a lot ,thank you so muchhhhhhh. You saved my time. I commented the Array.Prototype from my custom js file, it resolves my issue…

    • sottenad says:

      Hi Ignacio. Thanks for the feedback. For those who dont read Spanish, he is suggesting that you put your offending javascript in an edit-mode panel so that it only shows in the “display” setting, or when the page is NOT in edit mode. This seems like it could work pretty well unless you have code that formats things in edit mode that you need to preserve.

      <PublishingWebControls:EditModePanel ID="EditModePanelDisplay" runat="server" PageDisplayMode="Display">
       <script type="text/javascript" src="/Style Library/Scripts/jquery.js"></script> 

      • Beau Cameron says:

        Just a heads up to Sottenad, the solution of using PublishingWebControls won’t work on non-publishing pages. This is because non-publishing are always in display mode.

  2. Ron McKinney says:

    I’m getting this same error on all the pages in my SP site collection. But I haven’t added any custom Javascript to the Master Page or on the page content. Any ideas whatstep I can take to troubleshoot this issue?

    • Mark Drake says:

      @Ron – I’d be interested if you are using IE10. I’m experiencing the same issue when I attempt to add a web part to any page. I am using the OOTB v4 master page, IE10, and no custom code to debug the issue.

  3. Shereen says:

    thanks so much, would not have thought to look here!!

Leave a Reply