IE8 & IE7 JavaScript Date NaN From String Error

When trying to create a JavaScript Date object from a string I was getting an NaN error in IE7 and IE8. My JavaScript worked in all the other browsers I was testing in. I was writing the script to figure out future dates based on the date the user selected. Issue is that IE7 and 8 don’t handle strings as well as real browsers. I was able to fix the error by using date.setFullYear instead of expecting the browser to handle it. Found a great function in StackOverflow.com to handle this.

 

function parseISO8601(dateStringInRange) {
	var isoExp = /^\s*(\d{4})-(\d\d)-(\d\d)\s*$/,
		date = new Date(NaN), month,
		parts = isoExp.exec(dateStringInRange);

	if(parts) {
		month = +parts[2];
		date.setFullYear(parts[1], month - 1, parts[3]);
		if(month != date.getMonth() + 1) {
			date.setTime(NaN);
		}
	}
	return date;
}

You can check out my reduced test case.

IE8 IE7 403 HTTPS/SSL Error MAMP Fix

I was using browserstack.com to test a website on my local machine using MAMP when everything looked fine except on IE8 and IE7. I was getting 403 forbidden errors when trying to load the site in IE7 and 8 on Windows XP. Apparently the default SSL apache configuration in MAMP is set to not accept connections from browsers that don’t support Server Name Indication. “SNI” is supported on Internet Explorer 7.0 or later (on Vista, not XP). The solution is to comment out a line in the apache configuration that rejects requests from non SNI compatible browsers.

MAMP Solution

1. Open Apache httpd-ssl.conf template file for editing

edit apache httpd-ssl.conf file in mamp template

2. Comment out line

SSLStrictSNIVHostCheck on

to be

 #SSLStrictSNIVHostCheck on

httpd-ssl.conf line to comment out

3. Restart MAMP to have Apache reload httpd-ssl.conf

restart mamp server

 

Hope this how-to helped save you some of the frustration I had.

IE content not scrolling in overflow container

IE content not scrolling bug
IE content not scrolling bug

If you have some content in a container and the content isn’t scrolling, there is probably an easy fix. If any of the content inside the container that is position relative, the container must also be position relative.

Doesn’t work in IE

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Works in IE

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

Photo by Anderson Mancini

ie error expected identifier string or number

ie error expected identifier string or number
ie error expected identifier string or number

IE 7 was throwing an error while working on some JavaScript

ie error expected identifier string or number

The problem was that I had an extra comma in a hash

this.css({
      "position":"fixed",
      "top": ( $K(window).height() - this.height() ) / 2 + "px",
      "left": ( $K(window).width() - this.width() ) / 2 + "px",
    });

It should have been

this.css({
      "position":"fixed",
      "top": ( $K(window).height() - this.height() ) / 2 + "px",
      "left": ( $K(window).width() - this.width() ) / 2 + "px"
    });

Photo: By stealingsand