If you’re loading your page via file:
, then protocol-relative URLs aren’t going to work. The script tag has:
src="//cdn.youracclaim.com/assets/utilities/embed.js"
This should be changed to:
src="https://cdn.youracclaim.com/assets/utilities/embed.js"
You’ll find though that when you’re using an actual web server, this is a non-issue. The reason for the protocol-relative URLs is so that HTTP pages would use the HTTP version, and HTTPS would use the HTTPS version. This method is outdated anyway. HTTPS should be used everywhere, even if you’re loading HTTPS JavaScript from an HTTP page.
I have a certification and a badge provided by Acclaim. I want to embed it in my personal website but it’s not working. here’s the code they provided:
<div data-iframe-width="150" data-iframe-height="270" data-share-badge-id="60615e70-6409-4752-9d77-3553a43d13d2" data-share-badge-host="https://www.youracclaim.com"></div>
<script type="text/javascript" async src="//cdn.youracclaim.com/assets/utilities/embed.js"></script>
but even when simply put onto an empty html:5 page, I get the error: Loading failed for the <script> with source “file:///assets/utilities/embed.js”
.
What’s the problem here? I’m not sure how Acclaim can provide a ready-to-paste script that’s just simply not working, nothing shows up on the website. I’m guessing the problem is at the src...
part, but don’t know how to fix it.
@j08691 thank you for pointing that out. While checking through that .js file I found that it replaces the
@Chris No, you’re not understanding it. As I mentioned in my answer, this is basically relative to the protocol in-use. They’ve assumed you’re going to use
@Brad I have modified it exactly as in your answer and I get the error seen in my first comment. The replaced (by the embed.js file) div has the following code: