lira-mapa-teste
by Bruno Mucelini
HTML
<iframe title="Mapa Geral" id='iframe-mapa' frameBorder="0" style="width: 200px; height: 200px; background: blue" />
JavaScript
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
// this.response is a Blob, because we set responseType above
var data_url = URL.createObjectURL(this.response);
document.querySelector('#iframe-mapa').src = data_url;
} else {
console.error('Sem conteudo');
}
}
}
let xhr = new XMLHttpRequest();
xhr.open('GET', 'https://h1.angellira.com.br/api/map/53');
xhr.onreadystatechange = handler;
xhr.responseType = 'blob';
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem('TOKEN') );
xhr.send();