Loading

JavaScript 'startsWith' method not supported in Internet Explorer 11

Publiseringsdato: Oct 13, 2022
Beskrivelse

You may the following error message in browser console while using Internet Explorer 11. 

[Object doesn't support property or method 'startsWith']

This is caused by the use of the JavaScript method 'startsWith' being used in the Aura framework, which is not supported in IE11 any longer:

String.prototype.startsWith()

Løsning

To workaround this, you could either use a different browser or implement a polyfill if appropriate.

if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position){
      return this.substr(position || 0, searchString.length) === searchString;
  };
}
 There is also a more robust polyfill available on GitHub here, which can be added as a static resource and added as a dependency where needed.
Knowledge-artikkelnummer

000381505

 
Laster
Salesforce Help | Article