GENERATE QR CODE USING QRIOUS LIBRARY

 From our Module:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Qr code</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
      h2 {
        color: black;
        text-align: center;
      }
    </style>
    <script src = "https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
  </head>
    <h2>UI QR Code Basic Generator<h2>
    <input type="text" id="qr-code-value" placeholder="Enter a text or URL" value="https://www.google.com">
    <button onclick="generateQRCode()"> Generate QR code</button> <br/>
    <img id="qr-code-image" alt="QR code">


    <script>
      function generateQRCode() {
        // Get the value entered by the user
        const value = document.getElementById('qr-code-value').value;
        // Set the options for the QR code in dictionary format
        const options = {
        value: value, // The text or URL to encode in the QR code
        size: 400, // The size of the QR code in pixels
        level: 'H' // The error correction level of the QR code
        };
        // Create a new QR code object
        const qrCode = new QRious(options);
        // Get the QR code image as a data URL
        const qrCodeImage = qrCode.toDataURL();
        // Display the QR code image on the webpage
        // you can assign your default image here
        document.getElementById('qr-code-image').src = qrCodeImage;
      }
    </script>
  </body>
</html>

No comments:

Post a Comment

UNITY2D: SPAWN ENEMIES RANDOMLY/DYNAMICALLY AT RUN TIME

 Code: player.cs using System . Collections ; using System . Collections . Generic ; using UnityEngine ; using UnityEngine . SceneManage...