Browser Cookie Size Limit Checker
Enter cookie names and values below. The tool will calculate the size of each cookie and the total size, and check against the 4096 bytes (4KB) limit per cookie.
Total Size of Cookies: ${totalSize} bytes${totalWarning}
`; sizeResults.innerHTML = html; downloadPdfBtn.style.display = 'block'; }); // PDF generation function downloadPdfBtn.addEventListener('click', () => { const doc = new jsPDF(); doc.setFontSize(18); doc.setTextColor('#2c3e50'); doc.text('Browser Cookie Size Limit Checker Report', 105, 20, null, null, 'center'); let y = 40; const rows = container.children; if (rows.length === 0) { doc.setFontSize(14); doc.text('No cookies entered.', 20, y); doc.save('cookie_size_report.pdf'); return; } doc.setFontSize(14); doc.setTextColor('#34495e'); doc.text('Cookie Sizes (name: size in bytes):', 20, y); y += 10; let totalSize = 0; for (const row of rows) { const nameInput = row.querySelector('label:nth-child(1) input'); const valueInput = row.querySelector('label:nth-child(2) input'); const name = nameInput.value.trim(); const value = valueInput.value.trim(); if (!name || !value) continue; const size = calculateCookieSize(name, value); totalSize += size; doc.text(`${name}: ${size} bytes${size > 4096 ? ' (Exceeds 4096 bytes!)' : ''}`, 25, y); y += 8; if (y > 280) { doc.addPage(); y = 20; } } y += 8; doc.setFontSize(16); doc.setTextColor('#2c3e50'); doc.text(`Total Size of Cookies: ${totalSize} bytes`, 20, y); if (totalSize > (rows.length * 4096)) { y += 8; doc.setFontSize(14); doc.setTextColor('#e67e22'); doc.text('Warning: Total size may exceed typical browser limits for all cookies combined.', 20, y); } doc.save('cookie_size_report.pdf'); }); });