Search code examples
javascripthtmlidenticon

Generate Identicon using JDenticon


I try to use the JDenticon API (see JDenticon API) to generate an identicon using Javascript and have the picture displayed on a basic HTML site. Afterwards I want to get the image using Java. But for now I just want the image to be displayed on a HTML-document.

Here is the code of my test.html

<!DOCTYPE HTML>

<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <script src="//cdn.jsdelivr.net/jdenticon/1.3.2/jdenticon.min.js" async></script>

        <canvas width="200" height="200" data-jdenticon-hash="ff8adece0631821959f443c9d956fc39">
        Fallback text for browsers not supporting canvas</canvas>

        <svg width="200" height="200" data-jdenticon-hash="ff8adece0631821959f443c9d956fc39">
        Fallback text for browsers not supporting inline svg</svg>

    </body>
</html>

But when viewing test.html in Firefox there is no picture, why is that? I feel like I'm missing something really important but I canot figure out what it is.


Solution

  • You missed https:

    <!DOCTYPE HTML>
    
    <html>
        <head>
            <title>Test</title>
        </head>
        <body>
            <script src="https://cdn.jsdelivr.net/jdenticon/1.3.2/jdenticon.min.js" async></script>
    
            <canvas width="200" height="200" data-jdenticon-hash="ff8adece0631821959f443c9d956fc39">
            Fallback text for browsers not supporting canvas</canvas>
    
            <svg width="200" height="200" data-jdenticon-hash="ff8adece0631821959f443c9d956fc39">
            Fallback text for browsers not supporting inline svg</svg>
    
        </body>
    </html>