Overview
URL QR codes encode web addresses that users can quickly access by scanning. When scanned, the device automatically opens the URL in the default browser. This is one of the most common QR code types, ideal for marketing materials, business cards, and product packaging.Data Structure
URL QR codes use theUrlQrData interface:
The web address to encode. Can be provided with or without the protocol (http:// or https://). If no protocol is specified, https:// will be automatically prepended.
Encoding Format
The URL encoder (from/src/domain/encoders/encoders.ts:15-23) performs the following transformations:
- Trims whitespace from the URL
- Automatically prepends
https://if the URL doesn’t start withhttp://orhttps:// - Returns the normalized URL string
Example Encoding
| Input | Encoded Output |
|---|---|
example.com | https://example.com |
http://example.com | http://example.com |
https://example.com/page | https://example.com/page |
Validation Rules
The validator (from/src/domain/validation/validators.ts:56-69) enforces these requirements:
Required Field
Required Field
- The
urlfield cannot be empty or contain only whitespace - Error message: “La URL es obligatoria”
Valid URL Format
Valid URL Format
- Must be a valid URL format
- The validator automatically adds
https://protocol if missing before validation - Must pass JavaScript’s
URL()constructor validation - Error message: “La URL no es válida. Ej: https://ejemplo.com o ejemplo.com”
Validation Example
Usage Example
Common Use Cases
- Marketing: Link to product pages, landing pages, or promotional content
- Business Cards: Direct to company website or personal portfolio
- Print Media: Connect physical materials to digital content
- Event Materials: Link to event registration or information pages
- Product Packaging: Connect to product manuals, warranty info, or support pages