Spaces:
Paused
Paused
Create index.html
Browse files- index.html +29 -0
index.html
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>My Gradio App</title>
|
| 5 |
+
<script src="https://telegram.org/js/telegram-web-app.js"></script>
|
| 6 |
+
<script>
|
| 7 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 8 |
+
// Initialize the Telegram Web App
|
| 9 |
+
window.Telegram.WebApp.init();
|
| 10 |
+
|
| 11 |
+
// Example: Get user data
|
| 12 |
+
const user = window.Telegram.WebApp.initDataUnsafe.user;
|
| 13 |
+
console.log('Telegram user data:', user);
|
| 14 |
+
|
| 15 |
+
// Example: Set a custom title for the app
|
| 16 |
+
window.Telegram.WebApp.setTitle("My Gradio App");
|
| 17 |
+
|
| 18 |
+
// Example: Handle button click
|
| 19 |
+
document.getElementById('my-button').addEventListener('click', function() {
|
| 20 |
+
window.Telegram.WebApp.close();
|
| 21 |
+
});
|
| 22 |
+
});
|
| 23 |
+
</script>
|
| 24 |
+
</head>
|
| 25 |
+
<body>
|
| 26 |
+
<!-- Gradio app iframe -->
|
| 27 |
+
<iframe src="https://measmonysuon-WebApp.hf.space" width="100%" height="600px"></iframe>
|
| 28 |
+
</body>
|
| 29 |
+
</html>
|