66 lines
2.2 KiB
HTML
66 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>nuscore iframe Test</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
iframe { width: 100%; height: 600px; border: 2px solid #007bff; }
|
|
.status { padding: 10px; margin: 10px 0; background: #f8f9fa; border-radius: 4px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>nuscore iframe Test</h1>
|
|
|
|
<div class="status">
|
|
<strong>Test-URL:</strong> <span id="test-url"></span><br>
|
|
<strong>Status:</strong> <span id="status">Lädt...</span>
|
|
</div>
|
|
|
|
<iframe
|
|
id="test-iframe"
|
|
src="http://localhost:3000/api/proxy/nuscore?code=KXEA9JR5EUPW&pin=1555"
|
|
onload="iframeLoaded()"
|
|
onerror="iframeError()">
|
|
</iframe>
|
|
|
|
<script>
|
|
const iframe = document.getElementById('test-iframe');
|
|
const statusEl = document.getElementById('status');
|
|
const urlEl = document.getElementById('test-url');
|
|
|
|
urlEl.textContent = iframe.src;
|
|
|
|
function iframeLoaded() {
|
|
statusEl.textContent = '✅ Iframe geladen';
|
|
statusEl.style.color = 'green';
|
|
|
|
try {
|
|
// Versuche auf iframe-Inhalt zuzugreifen
|
|
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
if (iframeDoc) {
|
|
console.log('Iframe-Titel:', iframeDoc.title);
|
|
console.log('Iframe-Body:', iframeDoc.body ? 'Vorhanden' : 'Nicht vorhanden');
|
|
}
|
|
} catch (e) {
|
|
console.log('Cross-Origin-Zugriff blockiert (erwartet):', e.message);
|
|
}
|
|
}
|
|
|
|
function iframeError() {
|
|
statusEl.textContent = '❌ Iframe-Fehler';
|
|
statusEl.style.color = 'red';
|
|
}
|
|
|
|
// Timeout nach 10 Sekunden
|
|
setTimeout(() => {
|
|
if (statusEl.textContent === 'Lädt...') {
|
|
statusEl.textContent = '⏰ Timeout';
|
|
statusEl.style.color = 'orange';
|
|
}
|
|
}, 10000);
|
|
</script>
|
|
</body>
|
|
</html>
|