WebApp / index.html
measmonysuon's picture
Create index.html
d086a35 verified
raw
history blame
962 Bytes
<!DOCTYPE html>
<html>
<head>
<title>My Gradio App</title>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Initialize the Telegram Web App
window.Telegram.WebApp.init();
// Example: Get user data
const user = window.Telegram.WebApp.initDataUnsafe.user;
console.log('Telegram user data:', user);
// Example: Set a custom title for the app
window.Telegram.WebApp.setTitle("My Gradio App");
// Example: Handle button click
document.getElementById('my-button').addEventListener('click', function() {
window.Telegram.WebApp.close();
});
});
</script>
</head>
<body>
<!-- Gradio app iframe -->
<iframe src="https://measmonysuon-WebApp.hf.space" width="100%" height="600px"></iframe>
</body>
</html>