Loading

JavaScript 'startsWith' method not supported in Internet Explorer 11

Udgivelsesdato: Jun 22, 2026
Beskrivelse
Deprecation Notice: Microsoft Internet Explorer 11 (IE11) reached end-of-life on June 15, 2022. This article is retained for historical reference for customers on legacy implementations. For current Salesforce deployments, use a modern, supported browser.

When using Internet Explorer 11, you may see the following error message in the browser console:
"[Object doesn't support property or method 'startsWith']"
This error is caused by the use of the JavaScript String.prototype.startsWith() method in the Salesforce Aura framework. The startsWith() method is a standard ECMAScript 6 (ES6) string method that is not supported in IE11.

Løsning

Option 1: Use a Modern Browser (Recommended)

The simplest and recommended resolution is to use a modern browser that natively supports the startsWith() method:

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Edge (Chromium-based)
  • Apple Safari

All modern browsers support ES6 string methods including startsWith(), endsWith(), and includes() without any additional configuration. Salesforce's supported browser list does not include IE11.

Option 2: Implement a Polyfill (Legacy IE11 Support Only)

If migrating away from IE11 is not immediately possible, a JavaScript polyfill can be used to add startsWith() support to IE11.
The polyfill works by checking whether String.prototype.startsWith is already defined. If it is not (as is the case in IE11), the polyfill defines it as a function that extracts a substring starting at the specified position and compares it to the search string.
To use this polyfill in Salesforce:

  1. Add the polyfill script as a Static Resource in Salesforce
  2. Reference the Static Resource as a JavaScript dependency in the Aura component or Visualforce page that requires it

A more robust community polyfill (mathiasbynens/String.prototype.startsWith) is also available on GitHub and can be used as a Static Resource.
(See polyfill code example)

if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position){
      return this.substr(position || 0, searchString.length) === searchString;
  };
}
Vidensartikelnummer

000381505

 
Indlæser
Salesforce Help | Article