diff --git a/htmlpreview.js b/htmlpreview.js index 2f08b15..a38e616 100644 --- a/htmlpreview.js +++ b/htmlpreview.js @@ -89,8 +89,7 @@ var fetchProxy = function (url, options, i) { var proxy = [ - 'https://cors-anywhere.herokuapp.com/', - 'https://yacdn.org/proxy/', + '', // try without proxy first 'https://api.codetabs.com/v1/proxy/?quest=' ]; return fetch(proxy[i] + url, options).then(function (res) { @@ -104,10 +103,7 @@ }; if (url && url.indexOf(location.hostname) < 0) - fetch(url).then(function (res) { - if (!res.ok) throw new Error('Cannot load ' + url + ': ' + res.status + ' ' + res.statusText); - return res.text(); - }).then(loadHTML).catch(function (error) { + fetchProxy(url, null, 0).then(loadHTML).catch(function (error) { console.error(error); previewForm.style.display = 'block'; previewForm.innerText = error;