Model: Basic DataURL test overriding type


HTML

<model alt="A model of a teapot" data-src="./teapot.usdz" data-src="./teapot.usdz">
</model>
    

JavaScript

const model = document.querySelector('model');
const {src, type} = model.dataset;
const bytes = await (await fetch(src)).bytes();
const srcString = URL.createObjectURL(new Blob([bytes], {type}));
model.setAttribute('src', srcString);