[SOLVED] startsWith not supported in IE

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
Andreas
Posts: 13
Joined: Mon Dec 03, 2018 3:30 am

[SOLVED] startsWith not supported in IE

Postby Andreas » Mon Jan 14, 2019 1:50 am

Hi Folks,

It looks like startsWith / String.prototype.startsWith is not supported by IE (all the way up to 11). When executing in other browsers, the call works fine. IE 11 results in error: "SCRIPT438: Object doesn't support property or method 'startsWith'".
Is this something you should include, say as a workaround for IE:

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

Thanks,
Andreas

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: startsWith not supported in IE

Postby JS-Support @Userware » Mon Jan 21, 2019 6:24 am

Hi Andreas,

Thanks for your message.

We are going to include this code in the every next build.

In the meantime, you can add it to your app by putting the following C# code in the constructor of "App.xaml.cs" (the entry point of your app):

Code: Select all

Interop.ExecuteJavaScript(@"
    if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position) {
    position = position || 0;
    return this.indexOf(searchString, position) === position;
    };
    }
");


Thanks!
Regards

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: [SOLVED] startsWith not supported in IE

Postby JS-Support @Userware » Fri Feb 01, 2019 8:32 am

Hi,

The "String.prototype.startsWith" polyfill for IE 11 has now been added in v1.2 beta 11 and newer.

You can download it from:
viewforum.php?f=6

Thanks
Regards


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 49 guests

 

 

cron