I have an issue trying to use javascript to get the circulating supply by requesting data from Tzscan API:

HTML code to request the circulating supply:

<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <h1>There Tezos Circulating : </h1>
  <div id="getapi"></div>

Javascript Code to get the data from the API:

  function createNode(element) {
    return document.createElement(element);

  function append(parent, el) {
    return parent.appendChild(el);

  const ul = document.getElementById('getapi');
  const url = 'http://api6.tzscan.io/v3/supply';
    .then((resp) => resp.json())
    .then(function(data) {
      let span = createNode('span');
      span.innerHTML = `${data.circulating_supply/1000000}`;
      append(ul, span);
    .catch(function(error) {

The problem is that somehow it works when I create a HTML file locally but not online.

  • it'll help to also include the errors you are getting. I know we could probably look at your codepen but for the sake of the question, it's best include the errors in the question.
    – Frank
    Mar 25, 2019 at 3:20

1 Answer 1


You've encountered a mixed content error. Requests can't be a mixture of http and https, they need to be all of the same, preferably https. Just change the const url = 'http://api6.tzscan.io/v3/supply'; to be https

const url = 'https://api6.tzscan.io/v3/supply';

.then(resp => resp.json())
.then(({dls}) => {
    let span = createNode('span');
    span.innerHTML = dls;
    append(ul, span);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.