We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3545688 + dfb47f7 commit 787b673Copy full SHA for 787b673
htmlpreview.js
@@ -89,6 +89,7 @@
89
90
var fetchProxy = function (url, options, i) {
91
var proxy = [
92
+ '', // try without proxy first
93
'https://api.codetabs.com/v1/proxy/?quest='
94
];
95
return fetch(proxy[i] + url, options).then(function (res) {
@@ -102,10 +103,7 @@
102
103
};
104
105
if (url && url.indexOf(location.hostname) < 0)
- fetch(url).then(function (res) {
106
- if (!res.ok) throw new Error('Cannot load ' + url + ': ' + res.status + ' ' + res.statusText);
107
- return res.text();
108
- }).then(loadHTML).catch(function (error) {
+ fetchProxy(url, null, 0).then(loadHTML).catch(function (error) {
109
console.error(error);
110
previewForm.style.display = 'block';
111
previewForm.innerText = error;
0 commit comments