Skip to content

Instantly share code, notes, and snippets.

@m-arrieta-r
Created June 22, 2023 13:48
Show Gist options
  • Save m-arrieta-r/a8ba0c5d23b019d61bf32f0f17c5e7b9 to your computer and use it in GitHub Desktop.
Save m-arrieta-r/a8ba0c5d23b019d61bf32f0f17c5e7b9 to your computer and use it in GitHub Desktop.
iframely experiment
<html>
<head>
<title>Iframely Experiment</title>
</head>
<body>
<h1>Iframely Experiment</h1>
<div>
<figure class="media">
<oembed url="https://twitter.com/ice_panel/status/1668998855969628176"></oembed>
</figure>
</div>
<script>
document.querySelectorAll( 'oembed[url]' ).forEach(async (element) => {
const url = element.attributes.url.value;
const contentResponse = await fetch(`https://oembed.ameliarueda.com/oembed?url=${url}`);
const content = await contentResponse.json();
const div = document.createElement('div');
div.innerHTML = content.html;
element.parentElement.appendChild(div);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment