fixing bug in IE where link is throwing an error

This commit is contained in:
Jason Salzman
2017-05-22 04:18:05 -07:00
parent 4c2460de17
commit 02765d6f67
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -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": {
+8
View File
@@ -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;