0

Server: Sharepoint 2013 On-premise

Client : Windows 7 Pro. + IE 11

Case: We have deployed a Visual Web Part on a 'Web Part Page' in Sharepoint 2013 Server. As soon as client load this page on IE 11 browser it gives "SCRIPT438: Object doesn't support property or method 'startsWith'" JS error in the File "MicrosoftAjaxWebForms.js".

This Visual Web part is working fine on Sharepoint 2007. We are in the process of migration to Sharepoint 2013.

Any Hint to resolve this issue will be much appreciated.

Thanks

Hafeez

0

The startsWith method is not supported in the following document modes:

  • Quirks
  • Internet Explorer 6 standards
  • Internet Explorer 7 standards
  • Internet Explorer 8 standards
  • Internet Explorer 9 standards
  • Internet Explorer 10 standards
  • Internet Explorer 11 standards.

Not supported in Windows 8.1.

Take a look here.

However, you can use the following snippet in your visual webpart:

<script type="text/javascript">
    if (!String.prototype.startsWith) {
        String.prototype.startsWith = function (searchString, position) {
            position = position || 0;
            return this.indexOf(searchString, position) === position;
        };
    }
</script>
  • Thanks Cecilia for your reply. I have added this code already in my web part. But this JS error is coming in MicrosoftAjaxWebForms.js which loads before my web part. so there is any way to modify or load a JS file before MicrosoftAjaxWebForms.js is loaded by sharepoint ? – Newbie Jan 17 '17 at 21:27
  • You are welcome. Check it as correct answer if it was useful. – Cecilia Jan 17 '17 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.