diff --git a/public/assets/pt.js b/public/assets/pt.js index 2fe5511..2ed2592 100644 --- a/public/assets/pt.js +++ b/public/assets/pt.js @@ -8,6 +8,9 @@ var lsid = /^[a-z0-9]{6,20}$/i.test(P.lsid || '') ? P.lsid : ''; document.querySelectorAll('a[data-cta]').forEach(function (a) { try { var u = new URL(a.href); for (var k in P) if (!u.searchParams.has(k)) u.searchParams.set(k, P[k]); a.href = u.toString(); } catch (e) {} + // inside the ad viewer (a sandboxed frame with no top navigation) the button opens a new tab: an offer that refuses framing + // (X-Frame-Options: DENY) otherwise shows "refused to connect" in the frame (2026-11-23). Opened directly, the page is unchanged. + try { if (window.top !== window) { a.target = '_blank'; a.rel = 'noopener'; } } catch (e) { a.target = '_blank'; a.rel = 'noopener'; } a.addEventListener('click', function () { try { navigator.sendBeacon('/api/p/' + slug + '/hit', new Blob([JSON.stringify({ k: 'cta' })], { type: 'application/json' })); } catch (e) {} }); }); // the built-in form (.ls-form) usually arrives with the lsid filled by the server; this is the fallback. A pasted diff --git a/server.js b/server.js index 9744329..63b139a 100644 --- a/server.js +++ b/server.js @@ -1660,7 +1660,7 @@ const server = http.createServer(async (req, res) => { // the visitor's click id goes into the built-in form at render (2026-10-22): from ?lsid, else the ls.click cookie a // spin-link visit left earlier, so a lead counts as the rotator's 'lead' conversion even when the script never runs const formLsid = /^[a-z0-9]{6,20}$/i.test(lsid) ? lsid : (/^[a-z0-9]{6,20}$/i.test(String(parseCookies(req)['ls.click'] || '')) ? parseCookies(req)['ls.click'] : ''); - res.writeHead(200, hdr); return res.end(pages.html(pg, { leadUrl: '/p/' + pg.slug + '/lead', lsid: formLsid, trackSrc: '/assets/pt.js?v=2', footerLink: 'https://' + SITE_HOST + '/', footerText: 'Made with LinkSpin', pixel: 'https://' + SITE_HOST + '/p.gif?a=' + audiences.defaultFor(pg.owner) + '&e=page' })); + res.writeHead(200, hdr); return res.end(pages.html(pg, { leadUrl: '/p/' + pg.slug + '/lead', lsid: formLsid, trackSrc: '/assets/pt.js?v=3', footerLink: 'https://' + SITE_HOST + '/', footerText: 'Made with LinkSpin', pixel: 'https://' + SITE_HOST + '/p.gif?a=' + audiences.defaultFor(pg.owner) + '&e=page' })); } pm = /^\/p\/([a-z0-9-]{3,60})\/lead$/i.exec(p); if (pm && req.method === 'POST') {