Skip to content

Commit

Permalink
initData
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminbck committed Jun 24, 2024
1 parent 2c9af97 commit 26ebf68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@
<main>
This is the MAIN
<h1>Modals</h1>
<button onclick="Telegram.WebApp.showAlert('Hello World!');Telegram.WebApp.HapticFeedback.notificationOccurred('success');">Launch Alert</button>
<button onclick="showPopup();">Launch Popup</button>
<button onclick="Telegram.WebApp.showAlert('Hello World!');Telegram.WebApp.HapticFeedback.notificationOccurred('success');">Launch Alert</button></main><br>
<button onclick="showPopup();">Launch Popup</button></body><br>
<div onclick="Telegram.WebApp.HapticFeedback.notificationOccurred('success');">Click Me!</div>

<h1>Logs</h1>

<div id="InitData">InitData</div>
<div id="User">User</div>
<div id="Chat">Chat</div>

Expand All @@ -76,6 +78,7 @@ <h1>Server-Sent Events</h1>
Telegram.WebApp.expand();

// console log
document.getElementById("InitData").innerHTML = Telegram.WebApp.initData;
document.getElementById("User").innerHTML = Telegram.WebApp.initDataUnsafe.user.first_name + '</br>' + Telegram.WebApp.initDataUnsafe.user.username + '</br>';
document.getElementById("Chat").innerHTML = JSON.stringify(Telegram.WebApp.initDataUnsafe.chat);

Expand Down

0 comments on commit 26ebf68

Please sign in to comment.