JSFiddle - React, Tailwind, and code Playground

by David Simpson

CSS

img {
  border-radius: 50%
}

JavaScript

var xhr = new XMLHttpRequest();
xhr.responseType = 'blob'; //so you can access the response like a normal URL
xhr.onreadystatechange = function () {
    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
        var img = document.createElement('img');
        img.src = URL.createObjectURL(xhr.response); //create <img> with src set to the blob
        document.body.appendChild(img);
    }
};
xhr.open('GET', 'https://www.gravatar.com/avatar/dabc8480fbeffac58f2207eb653ef440?s=100', true);
/* xhr.setRequestHeader('SecretPassword', 'password123'); */
xhr.send();