<div id="out"></div>
#out {
white-space: pre;
}
function checkByImage(src) {
// антикэщ
src += (src.includes('?') ? '&' : '?') + Math.random();
return new Promise(reslove => Object.assign(new Image(), {
onload: () => reslove(true),
onerror: () => reslove(false),
src
}))
}
async function check(toCheckList) {
for(const name in toCheckList) {
out.append(`${name}: `);
const ok = await checkByImage(toCheckList[name]) ;
out.append(ok ? 'доступен' : 'недоступен', '\n');
}
}
check({
'patreon.com':'https://patreon.com/favicon.ico',
'boosty.to': 'https://boosty.to/favicon.ico',
'linkedin.com': 'https://linkedin.com/favicon.ico'
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.