diff --git a/htmlpreview.js b/htmlpreview.js
index 1390c01..a38e616 100644
--- a/htmlpreview.js
+++ b/htmlpreview.js
@@ -55,6 +55,7 @@
for (i = 0; i < res.length; ++i) {
loadJS(res[i]);
}
+ document.dispatchEvent(new Event('DOMContentLoaded', {bubbles: true, cancelable: true})); //Dispatch DOMContentLoaded event after loading all scripts
});
};
@@ -88,13 +89,11 @@
var fetchProxy = function (url, options, i) {
var proxy = [
- 'https://cors.io/?',
- 'https://jsonp.afeld.me/?url=',
- 'https://cors-anywhere.herokuapp.com/'
+ '', // try without proxy first
+ 'https://api.codetabs.com/v1/proxy/?quest='
];
return fetch(proxy[i] + url, options).then(function (res) {
- if (!res.ok)
- throw new Error('Cannot load ' + url + ': ' + res.status + ' ' + res.statusText);
+ if (!res.ok) throw new Error('Cannot load ' + url + ': ' + res.status + ' ' + res.statusText);
return res.text();
}).catch(function (error) {
if (i === proxy.length - 1)
diff --git a/readme.md b/readme.md
index 33818c5..3721989 100644
--- a/readme.md
+++ b/readme.md
@@ -12,7 +12,7 @@ In order to use it, just prepend this fragment to the URL of any HTML file: **[h
- https://htmlpreview.github.io/?https://github.com/twbs/bootstrap/gh-pages/2.3.2/index.html
- https://htmlpreview.github.io/?https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
-What it does is: load HTML using CORS proxy, then process all links, frames, scripts and styles, and load each of them using CORS proxy, so they can be evaluted by the browser.
+What it does is: load HTML using CORS proxy, then process all links, frames, scripts and styles, and load each of them using CORS proxy, so they can be evaluated by the browser.
**GitHub & BitBucket HTML Preview** was tested under the latest Google Chrome and Mozilla Firefox.