बंद करे

क्यू आर जेनरेटर

QR Code Generator — Paste & Download body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; max-width:720px; margin:48px auto; padding:0 16px; color:#111; } h1{margin-bottom:6px;font-size:20px} .row{display:flex;gap:8px;align-items:center} input[type="text"]{flex:1;padding:10px;border:1px solid #ccc;border-radius:6px} button{padding:10px 14px;border-radius:6px;border:1px solid #0b6; background:#0b6;color:#fff;cursor:pointer} button.secondary{background:#666;border-color:#666} #qr{border:1px dashed #ddd;margin-top:12px;border-radius:6px;background:#fff} a#download{display:none;margin-left:8px;padding:8px 10px;border-radius:6px;border:1px solid #036;background:#036;color:#fff;text-decoration:none} .note{font-size:13px;color:#444;margin-top:8px}

QR generator — paste link & download

Download PNG
Tip: paste then press Generate. If you paste a domain without protocol we add https:// automatically.
(function(){ const input = document.getElementById('url'); const btn = document.getElementById('gen'); const canvas = document.getElementById('qr'); const download = document.getElementById('download'); // Validate & normalize URL: if no scheme, add https:// function normalizeUrl(raw){ if(!raw) return ''; let s = raw.trim(); // quick check for spaces (reject) if(/\s/.test(s)) return ''; try { // if it has scheme, let URL constructor validate new URL(s); return s; } catch(e) { // try adding https:// try { const withProto = 'https://' + s; new URL(withProto); return withProto; } catch(e2){ return ''; } } } // Generate QR onto canvas and prepare download link async function generateQR(){ const raw = input.value; const url = normalizeUrl(raw); if(!url){ alert('Please paste a valid link (no spaces).'); return; } // Options: error correction H (best), scale controls pixel size. const opts = { errorCorrectionLevel: 'H', type: 'image/png', quality: 0.92, margin: 2, // quiet zone scale: 8 // 8 -> ~256px for small data; increase for higher res }; try { // Use library to draw to canvas await QRCode.toCanvas(canvas, url, opts); // Update download link download.href = canvas.toDataURL('image/png'); download.style.display = 'inline-block'; // Set a helpful filename derived from hostname try { const hostname = (new URL(url)).hostname.replace(/^www\./,''); download.download = `qr-${hostname}.png`; } catch(e){ download.download = 'qr.png'; } } catch(err){ console.error(err); alert('Failed to generate QR code. See console for details.'); } } // Events btn.addEventListener('click', generateQR); // Generate on paste (user asked paste-friendly) input.addEventListener('paste', function(e){ // Wait a tick for paste event to populate input setTimeout(generateQR, 150); }); // Optional: generate on Enter input.addEventListener('keydown', function(e){ if(e.key === 'Enter') generateQR(); }); // Provide a small default example input.value = ''; // If you want an initial demo, uncomment: // input.value = 'https://example.com'; generateQR(); })();