Created
June 22, 2023 13:48
-
-
Save m-arrieta-r/a8ba0c5d23b019d61bf32f0f17c5e7b9 to your computer and use it in GitHub Desktop.
iframely experiment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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