Ad view: reliable exit on mobile/dApp browsers
window.close() is blocked in mobile and in-app wallet (dApp) browsers, which left users stuck on the ad-view tab. Made "Back to dashboard" the primary action, and "Close tab" now falls back to navigating to /my#earn when the browser refuses to close the tab. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -82,7 +82,12 @@
|
||||
}
|
||||
$('vClose').addEventListener('click', () => {
|
||||
window.close();
|
||||
setMsg('You can close this tab now.');
|
||||
// window.close() is blocked in mobile and in-app (wallet dApp) browsers. If
|
||||
// the tab is still here a moment later, take them back to the dashboard so
|
||||
// they are never stuck on a tab they can't close.
|
||||
setTimeout(() => {
|
||||
if (!window.closed) { setMsg('Taking you back to your dashboard…'); location.href = '/my#earn'; }
|
||||
}, 400);
|
||||
});
|
||||
(async () => {
|
||||
const info = await j('/api/my/viewinfo?token=' + token);
|
||||
|
||||
Reference in New Issue
Block a user