You can generate an arbitrary QR code directly in Firefox without needing an extension or internet access by using Firefox’s built-in developer tools and a simple HTML/JavaScript snippet. Here’s how to do it:
Ctrl + Shift + K to open the Web Console.Copy and paste the following JavaScript code into the Scratchpad:
javascript// Create a new div to hold the QR code let qrDiv = document.createElement('div'); qrDiv.id = 'qrCode'; document.body.appendChild(qrDiv); // Load the QRCode library (offline) let s = document.createElement('script'); s.src = 'https://cdn.jsdelivr.net/npm/qrcode@1.5.1/build/qrcode.min.js'; document.head.appendChild(s); // Wait for the library to load s.onload = function() { let text = prompt('Enter text to encode in the QR code:'); if (text) { QRCode.toCanvas(document.getElementById('qrCode'), text, function (error) { if (error) console.error(error); }); } };
If you want a more permanent solution, you can create a local HTML file with the following content:
html<!DOCTYPE html> <html> <head> <title>Offline QR Code Generator</title> <script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.1/build/qrcode.min.js"></script> </head> <body> <h1>Offline QR Code Generator</h1> <input type="text" id="textInput" placeholder="Enter text..."> <button onclick="generateQRCode()">Generate QR Code</button> <div id="qrCode"></div> <script> function generateQRCode() { let text = document.getElementById('textInput').value; if (text) { QRCode.toCanvas(document.getElementById('qrCode'), text, function (error) { if (error) console.error(error); }); } } </script> </body> </html>
qrcode.html on your computer.src with a local path.