Skip to content

Commit 02765d6

Browse files
committed
fixing bug in IE where link is throwing an error
1 parent 4c2460d commit 02765d6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Jason Salzman",
33
"name": "react-add-to-calendar",
44
"description": "A simple and reusable add to calendar button component for React",
5-
"version": "0.0.11",
5+
"version": "0.0.12",
66
"license": "MIT",
77
"homepage": "https://github.com/jasonsalzman/react-add-to-calendar",
88
"repository": {

src/ReactAddToCalendar.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export default class ReactAddToCalendar extends React.Component {
1919
}
2020

2121
componentWillMount() {
22+
// polyfill for startsWith to fix IE bug
23+
if (!String.prototype.startsWith) {
24+
String.prototype.startsWith = function(searchString, position) {
25+
position = position || 0;
26+
return this.indexOf(searchString, position) === position;
27+
};
28+
}
29+
2230
let isCrappyIE = false;
2331
if (typeof window !== 'undefined' && window.navigator.msSaveOrOpenBlob && window.Blob) {
2432
isCrappyIE = true;

0 commit comments

Comments
 (0)