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', () => {
|
$('vClose').addEventListener('click', () => {
|
||||||
window.close();
|
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 () => {
|
(async () => {
|
||||||
const info = await j('/api/my/viewinfo?token=' + token);
|
const info = await j('/api/my/viewinfo?token=' + token);
|
||||||
|
|||||||
+3
-3
@@ -38,12 +38,12 @@
|
|||||||
<span class="vmsg" id="vMsg">Loading the ad…</span>
|
<span class="vmsg" id="vMsg">Loading the ad…</span>
|
||||||
<span class="vcheck" id="vCheck"><span class="prompt" id="vPrompt"></span><span id="vOpts"></span></span>
|
<span class="vcheck" id="vCheck"><span class="prompt" id="vPrompt"></span><span id="vOpts"></span></span>
|
||||||
<span class="vdone" id="vDone">
|
<span class="vdone" id="vDone">
|
||||||
<button class="btn small" id="vClose" type="button">Close tab</button>
|
<a class="btn small" href="/my#earn">Back to dashboard</a>
|
||||||
<a class="btn small sec" href="/my#earn">Back to dashboard</a>
|
<button class="btn small sec" id="vClose" type="button">Close tab</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<iframe class="vframe" id="vFrame" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" referrerpolicy="no-referrer" title="Advertiser site"></iframe>
|
<iframe class="vframe" id="vFrame" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" referrerpolicy="no-referrer" title="Advertiser site"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/view.js?v=20260906m"></script>
|
<script src="/assets/view.js?v=20260908a"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user