diff --git a/templates/qr.mustache b/templates/qr.mustache
index 6e3ab0f..12432d3 100644
--- a/templates/qr.mustache
+++ b/templates/qr.mustache
@@ -102,6 +102,7 @@
 {{#qrcodecontent}}
     <script src="{{javascript}}"></script>
     {{#js}}
+        if (typeof QRCode !== 'undefined') {
         let config{{id}} = {
             content: "{{{qrcodecontent}}}",
             color: "#000000",
@@ -114,5 +115,6 @@
         let qrcode{{id}} = new QRCode(config{{id}});
         let svg{{id}} = qrcode{{id}}.svg();
         document.getElementById("container{{id}}").innerHTML = svg{{id}};
+        }
     {{/js}}
 {{/qrcodecontent}}