chat / capt.html
Reaperxxxx's picture
Create capt.html
d8d87c8 verified
Raw
History Blame Contribute Delete
1.88 kB
How does this work
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Capture tgWebAppData</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<style>
body { font-family: system-ui, Arial; padding: 18px; background:#0f0f10; color:#eaeaea; }
textarea { width:100%; height:160px; background:#111; color:#eaeaea; border:1px solid #333; padding:8px; }
button { padding:10px 14px; margin:8px 6px 0 0; }
.note { color:#aaa; font-size:0.9rem; margin-top:8px }
</style>
</head>
<body>
<h3>Capture tgWebAppData</h3>
<p>When opened in Telegram, this page will show the full URL (including <code>#tgWebAppData=…</code>).</p>
<textarea id="out" readonly>Waiting for fragment…</textarea>
<div>
<button id="copy">Copy URL</button>
<button id="continue">Continue to target</button>
</div>
<p class="note">Privacy: this page does NOT send data anywhere unless you add that behavior. The user should only share this URL if they consent.</p>
<script>
(async function(){
const out = document.getElementById('out');
const copyBtn = document.getElementById('copy');
const cont = document.getElementById('continue');
// show full href (includes fragment if present)
const full = location.href;
out.value = full;
copyBtn.addEventListener('click', async () => {
try {
await navigator.clipboard.writeText(out.value);
alert('URL copied to clipboard');
} catch(e) {
prompt('Copy this URL', out.value);
}
});
cont.addEventListener('click', () => {
const qs = new URLSearchParams(location.search);
const target = qs.get('target') || '';
if (!target) {
alert('No target specified in ?target=...');
return;
}
// preserve same fragment when forwarding
location.replace(target + location.hash);
});
})();
</script>
</body>
</html>