async function postData(){
fetch('/favicon.ico?_=16505383').then(function(res){
if(res.headers.get('Content-Type').split('/')[0]=='image'){
var test='test1';
}else{
var test='test2';
}
}).catch((error) => {
var test='test1';
});
return test;
}
if(await postData()=='online'){
console.log('online')
}else{
console.log('offline')
}
var online=(async()=>{
if(navigator.onLine){
var date=+new Date();
var res=await fetch('/favicon.ico?_='+date);
var ret=await res.headers.get('Content-Type').split('/')[0]=='image';
}else
ret=navigator.onLine;
return ret;
});
if(await online()==true){
console.log('online')
}else{
console.log('offline')
}