voice_detection / connection_test.html
ranar110
Fix: Use absolute path for tester.html and add path debugging
f6d50b1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Connection Test</title>
<style>
body {
font-family: sans-serif;
padding: 20px;
text-align: center;
}
.status {
margin: 20px;
padding: 10px;
border-radius: 5px;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Voice Detection Site Connection Test</h1>
<p>Click the button below to test if your browser can reach the live site.</p>
<button onclick="checkSite()">Test Connection</button>
<div id="result" class="status" style="display:none;"></div>
<script>
async function checkSite() {
const resultDiv = document.getElementById('result');
resultDiv.style.display = 'block';
resultDiv.innerHTML = 'Testing connection...';
resultDiv.className = 'status';
try {
// Try to fetch the main page
const response = await fetch('https://ranar118-voice-detection.hf.space/', {
method: 'GET',
mode: 'no-cors' // Use no-cors to avoid CORS errors for simple connectivity check
});
resultDiv.innerHTML = '<strong>✅ Connection Successful!</strong><br>Your browser can reach the site.<br><br><a href="https://ranar118-voice-detection.hf.space/" target="_blank">Click here to open the site</a>';
resultDiv.className = 'status success';
} catch (error) {
resultDiv.innerHTML = '<strong>❌ Connection Failed</strong><br>Error: ' + error.message + '<br><br>Possible connection issue or firewall blocking the site.';
resultDiv.className = 'status error';
}
}
</script>
</body>
</html>