Snippets: RealVNC Viewer Profile Generator
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; } .container { background: white; border-radius: 15px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); padding: 40px; width: 100%; max-width: 500px; animation: slideUp 0.6s ease-out; } @keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } } h1 { text-align: center; color: #333; margin-bottom: 30px; font-size: 28px; font-weight: 600; } .form-group { margin-bottom: 20px; } label { display: block; margin-bottom: 8px; color: #555; font-weight: 500; font-size: 14px; } input, select { width: 100%; padding: 12px 15px; border: 2px solid #e1e5e9; border-radius: 8px; font-size: 16px; transition: border-color 0.3s ease, box-shadow 0.3s ease; background-color: #f8f9fa; } input:focus, select:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); background-color: white; } button { width: 100%; padding: 15px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; margin-top: 10px; } button:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3); } button:active { transform: translateY(0); } .required::after { content: " *"; color: #e74c3c; } .note { font-size: 12px; color: #7f8c8d; margin-top: 5px; font-style: italic; } @media (max-width: 600px) { .container { padding: 25px; margin: 10px; } h1 { font-size: 24px; } input, select, button { padding: 12px; font-size: 16px; /* Prevents zoom on iOS */ } }
CSS Before Head
HTML Head
CSS After Head
JS Before HTML Body
<div class="container"> <h1>RealVNC Viewer Profile Generator</h1> <form id="vncForm"> <div class="form-group"> <label for="host" class="required">Host</label> <input type="text" id="host" name="host" required placeholder="e.g., localhost or 192.168.1.100"> </div> <div class="form-group"> <label for="port">Port</label> <input type="number" id="port" name="port" value="5900" placeholder="Default: 5900"> <div class="note">Leave blank to use default value 5900</div> </div> <div class="form-group"> <label for="labels">Labels</label> <input type="text" id="labels" name="labels" placeholder="e.g., Work, Home"> <div class="note">Optional, separate multiple labels with commas</div> </div> <div class="form-group"> <label for="username" class="required">Username</label> <input type="text" id="username" name="username" value="ezra" required placeholder="Enter username"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" id="password" name="password" placeholder="Enter password"> <div class="note">Optional, leave blank to enter during connection</div> </div> <div class="form-group"> <label for="filename" class="required">File Name</label> <input type="text" id="filename" name="filename" required placeholder="e.g., MyServer" pattern="[a-zA-Z0-9_-]+"> <div class="note">File name can only contain letters, numbers, underscores, and hyphens</div> </div> <button type="submit">Generate VNC File</button> </form> </div>
HTML Body
HTML Foot
document.getElementById('vncForm').addEventListener('submit', function(e) { e.preventDefault(); const formData = new FormData(this); const host = formData.get('host'); const port = formData.get('port') || '5900'; const labels = formData.get('labels'); const username = formData.get('username') || 'ezra'; const password = formData.get('password'); const filename = formData.get('filename'); // Generate current time (ISO format) const connTime = new Date().toISOString(); // Generate UUID (simplified version) const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0; const v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); // Build VNC configuration content let vncContent = `ConnMethod=tcp\n`; vncContent += `ConnTime=${connTime}\n`; vncContent += `Encryption=PreferOn\n`; vncContent += `FullScreenMonitors=\n`; vncContent += `Host=${host}\n`; vncContent += `Port=${port}\n`; vncContent += `RelativePtr=0\n`; vncContent += `Uuid=${uuid}\n`; if (labels) { vncContent += `Labels=${labels}\n`; } else { vncContent += `Labels=\n`; } vncContent += `UserName=${username}\n`; if (password) { vncContent += `Password=${password}\n`; } else { vncContent += `Password=\n`; } // Create and download file const blob = new Blob([vncContent], { type: 'application/octet-stream' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `${filename}.vnc`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); });
JS After HTML Body
Full HTML Code