Spaces:
Running
Running
Update index.html
Browse files- index.html +37 -19
index.html
CHANGED
|
@@ -84,24 +84,42 @@
|
|
| 84 |
</div>
|
| 85 |
|
| 86 |
<script>
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
</body>
|
| 107 |
</html>
|
|
|
|
| 84 |
</div>
|
| 85 |
|
| 86 |
<script>
|
| 87 |
+
// Get the current URL
|
| 88 |
+
const currentUrl = window.location.href;
|
| 89 |
+
const iframe = document.querySelector('iframe');
|
| 90 |
+
|
| 91 |
+
// Option 1: If you want to load an external URL (your https://1hit.no/audio/suno/)
|
| 92 |
+
iframe.src = 'https://1hit.no/audio/suno/';
|
| 93 |
+
|
| 94 |
+
// Option 2: If you want to load your Gradio app (running in the same Space)
|
| 95 |
+
// iframe.src = currentUrl; // This would load the current page in the iframe (might create a loop)
|
| 96 |
+
// iframe.src = currentUrl + 'app'; // Try this if Gradio is at /app endpoint
|
| 97 |
+
|
| 98 |
+
// Option 3: If your Gradio app runs on a specific port within the Space
|
| 99 |
+
// iframe.src = 'https://huggingface.co/spaces/MySafeCode/RepurposedSunoCoverPlayer/app';
|
| 100 |
+
|
| 101 |
+
// Handle iframe loading messages for dynamic height
|
| 102 |
+
window.addEventListener('message', function(event) {
|
| 103 |
+
if (event.data && event.data.type === 'gradio_height') {
|
| 104 |
+
iframe.style.height = event.data.height + 'px';
|
| 105 |
+
}
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
// Add error handling
|
| 109 |
+
iframe.onload = function() {
|
| 110 |
+
console.log('Iframe loaded successfully');
|
| 111 |
+
};
|
| 112 |
+
|
| 113 |
+
iframe.onerror = function() {
|
| 114 |
+
console.error('Failed to load iframe content');
|
| 115 |
+
// Show a fallback message
|
| 116 |
+
document.querySelector('.app-frame').innerHTML =
|
| 117 |
+
'<div style="padding: 40px; text-align: center; color: #666;">' +
|
| 118 |
+
'<h3>⚠️ Content Failed to Load</h3>' +
|
| 119 |
+
'<p>The embedded application could not be loaded.</p>' +
|
| 120 |
+
'<p><a href="https://1hit.no/audio/suno/" target="_blank">Click here to open in a new tab</a></p>' +
|
| 121 |
+
'</div>';
|
| 122 |
+
};
|
| 123 |
+
</script>
|
| 124 |
</body>
|
| 125 |
</html>
|