internet explorer issue - object does not support property startsWith

  • 1
  • Problem
  • Updated 1 year ago
  • Solved
Getting an issue for our community users in Internet Explorer. Why does anyone use Internet Explorer?? I don't know, but they do. And things aren't working. Entire page is stuck loading records, error in the console shows "object does not support property startsWith"

It's a page include in a page with a header. I've had issues with Headers before in IE, but this header is loading, just not any models. Are there known issues with page includes in IE?
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Looks like this is fixed in 9.5.1 and 9.3.5. I've got 9.5 installed now, which should I install? Confusing as 9.3.5 is on top of 9.5.1 in the release list. 
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Jack,

Brooklyn Update 1 was an update release because it made some improvements / changes larger than in a typical maintenance release. In a way, it split our product into two slightly different versions - Brooklyn iterations and Brooklyn Update iterations. Brooklyn Iteration 5 is following in the steps of Brooklyn Iteration 4 and does not include the improvements made in Brooklyn Update 1.  Brooklyn Update 1 Iteration 1 is the improvement after Brooklyn Update 1, so it includes everything in Brooklyn Update 1 plus bug fixes. Hope that clarifies things a little.
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Installing 9.5.1 did not fix things for IE 10 users, who are just getting a blank screen. This wasn't happening before Brooklyn. 
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Issue is fixed for IE 11. 
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
So this is still an issue in IE9. Turns out my user that couldn't access it was using IE11... in IE9 mode. Banks right?

Anyway here's the console errors that show up in IE9, in case anyone cares. Why won't IE just die already???

SCRIPT5007: Unable to set value of the property 'saveAs': object is null or undefined 
skuid__SkuidJS, line 3 character 21448

SCRIPT5007: Unable to get value of the property 'SALESFORCE': object is null or undefined 
skuid__PlatformJS, line 2 character 4737

SCRIPT5007: Unable to get value of the property '_setAttachmentBaseUrl': object is null or undefined 
, line 48 character 13

SCRIPT5007: Unable to get value of the property 'size': object is null or undefined 
skuid__UiOnlyDataSourceTypeJS, line 1 character 99

SCRIPT5007: Unable to get value of the property 'DISPLAY_TYPES': object is null or undefined 
skuid__SalesforceDataSourceTypeJS, line 1 character 14550

SCRIPT5007: Unable to get value of the property 'registerPlugin': object is null or undefined 
core.js, line 1 character 11016

SCRIPT5007: Unable to get value of the property 'register': object is null or undefined 
salesforce.js, line 2 character 34

SCRIPT5007: Unable to get value of the property 'DataSource': object is null or undefined 
, line 57 character 1
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
I was able to get our users to switch to Chrome, until today. And IE users are getting blank screens. I logged a support case but wanted to also update it here.
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
current error I'm getting is Object doesn't support property or method 'includes'
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
was able to completely replace includes, but also ran into this issue with endsWith. Here's a solution to that, just insert this code into the beginning of any snippet using endsWith, and endsWith seems to function:
 if (typeof String.prototype.endsWith !== 'function') {
    String.prototype.endsWith = function(suffix) {
        return this.indexOf(suffix, this.length - suffix.length) !== -1;
    };
}

source: https://stackoverflow.com/questions/280634/endswith-in-javascript
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Jack,

Thanks for keeping us informed about how you were able to work around your problem (but sorry you had a problem in the first place!). Would you be willing to either post a little of your snippet or explain how you're using startsWith() and endsWith()? I can't find includes in our API, so I'm not sure if it's supported, but I have found endsWith and startsWith listed under skuid.utils here. If those are the methods you're using we'd like to investigate why they aren't working as expected.

Thanks!
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Hi Amy, here's my snippet. I'm using it on a page where I have 17 models whose names end with 'Count', and I want do do something specific with all those models (without typing out all 17 names of them)

	if (singleIndicator.data.length > 0){
	     if (typeof String.prototype.endsWith !== 'function') {
    String.prototype.endsWith = function(suffix) {
        return this.indexOf(suffix, this.length - suffix.length) !== -1;
    };
}
		$.each(allModels, function(){
		    var model = this;
		   //console.log(model);
		    var name = model.id;
		  //  console.log("name="+name);
		    var isCount = name.endsWith('Count');
		   
		//    console.log('isCount='+isCount);
		    if (isCount ) {
		 //   console.log('modeltoload='+name);
		    
		    updateModels.push(model);
		    }
		
		

	}
	)}
(Edited)
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Here's a couple examples of how I was using .includes:
Example1:
var field = arguments[0], 
    row = field.row,
    
    // set the render condition
    isPercentage = ((row.Indicator__r.Benchmark_Type__c.includes('Percentage'))&& (row.Indicator__r.Type__c == 'Yes')) ? true : false;

Example 2:

if (field.mode == 'readonly' && benchmarkType.includes('Maximum') && value >= benchmarkRed) 

    { 

        field.element.css({'background-color':'#fc8d62','color':'white'}); 


    }
	
else if (field.mode == 'readonly' && benchmarkType.includes('Minimum') && value <= benchmarkRed) 

    { 

        field.element.css({'background-color':'#fc8d62','color':'white'}); 


    }

Since there are only four picklist values in the field Benchmark Type (Benchmark Maximum, Benchmark Minimum, Percentage Maximum, Percentage Minimum) and any includes statement was just looking for if the value for this row was either of two values, I just switched all includes for two equals statements separated by OR, for example  "if Benchmark Type == Percentage Maximum || Benchmark Type == Percentage Minimum", but if there were lots more values to compare I'm not sure how I would do it, don't want too many OR statements. 
(Edited)
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Jack,

I think I've been able to reproduce this issue on IE11, but I don't seem to see it on Edge. Is it possible for your users to use Edge as a workaround in the meantime? I've notified our developers of this issue and we'll let you know when this is fixed in a future release
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Jack,

Unfortunately, I spoke too soon. There isn't an issue with endsWith, you just have to make sure to use skuid.utils.endsWith. For includes, I wasn't able to find it in our listed API, so I think you need to use skuid.utils.contains instead.