Skip to content

Commit

Permalink
Fix for IE11 (#2778)
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim authored Dec 30, 2019
1 parent 3c78937 commit f3275bc
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions samples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,24 @@
<html lang="en-US">
<head>
<title>Web Chat samples</title>
<script crossorigin="anonymous" src="https://unpkg.com/core-js@2/client/core.min.js"></script>
<script crossorigin="anonymous" src="https://unpkg.com/markdown-it/dist/markdown-it.min.js"></script>
<script crossorigin="anonymous" src="https://unpkg.com/whatwg-fetch"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="index.css" />
</head>
<body>
<script>
function loadScript(src) {
return new Promise((resolve, reject) => {
const element = document.createElement('script');
'use strict';

element.async = true;
element.onerror = reject;
element.onload = resolve;
element.src = src;
fetch('README.md')
.then(function (res) { return res.text(); })
.then(function (markdown) {
const element = document.createElement('div');

document.head.appendChild(element);
element.innerHTML = window.markdownit().render(markdown);
document.body.appendChild(element);
});
}

(async function() {
'use strict';

const [markdown] = await Promise.all([
fetch('README.md').then(res => res.text()),
loadScript('https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.4.2/markdown-it.min.js')
]);

const element = document.createElement('div');

element.innerHTML = window.markdownit().render(markdown);
document.body.appendChild(element);
})().catch(err => console.error(err));
</script>
</body>
</html>

0 comments on commit f3275bc

Please sign in to comment.