IE doesn’t support some of the String methods which is available with other browsers. String.endsWith is one of them. One of the simple solution is to define its prototype as below.
if (!String.prototype.endsWith) { String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; }
Just add above javascript code in to a javascript file (Definitely it should execute before you call String.endsWith in your code) to fix this issue.