使用JDenticon生成Identicon

时间:2016-07-04 11:53:22

标签: javascript html identicon

我尝试使用JDenticon API(请参阅JDenticon API)使用Javascript生成identicon并将图片显示在基本HTML网站上。之后我想用Java获取图像。但是现在我只想让图像显示在HTML文档上。

以下是 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>

但是在Firefox中查看 test.html 时没有图片,为什么呢?我觉得我错过了一些非常重要的东西,但我能够弄清楚它是什么。

1 个答案:

答案 0 :(得分:2)

你错过了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>