From 02765d6f677db0e57082f58e3549834e85a433c4 Mon Sep 17 00:00:00 2001 From: Jason Salzman Date: Mon, 22 May 2017 04:18:05 -0700 Subject: [PATCH] fixing bug in IE where link is throwing an error --- package.json | 2 +- src/ReactAddToCalendar.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 90d92bd..1f4c0e0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Jason Salzman", "name": "react-add-to-calendar", "description": "A simple and reusable add to calendar button component for React", - "version": "0.0.11", + "version": "0.0.12", "license": "MIT", "homepage": "https://github.com/jasonsalzman/react-add-to-calendar", "repository": { diff --git a/src/ReactAddToCalendar.js b/src/ReactAddToCalendar.js index f04ea1b..dbc4f9b 100644 --- a/src/ReactAddToCalendar.js +++ b/src/ReactAddToCalendar.js @@ -19,6 +19,14 @@ export default class ReactAddToCalendar extends React.Component { } componentWillMount() { + // polyfill for startsWith to fix IE bug + if (!String.prototype.startsWith) { + String.prototype.startsWith = function(searchString, position) { + position = position || 0; + return this.indexOf(searchString, position) === position; + }; + } + let isCrappyIE = false; if (typeof window !== 'undefined' && window.navigator.msSaveOrOpenBlob && window.Blob) { isCrappyIE = true;