Created
February 20, 2022 11:16
-
-
Save Utopiah/b076c63afe4fb84322089c4f42d4c4ce to your computer and use it in GitHub Desktop.
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
// to run on e.g hubs.mozilla.com in a room | |
fetch('/cloud').then(function (response) { | |
// limited due to CSP | |
return response.text(); | |
}).then(function (html) { | |
var parser = new DOMParser(); | |
var doc = parser.parseFromString(html, 'text/html'); | |
var desc = doc.head.querySelector('meta[property="og:description"]').content; | |
var el = document.createElement("a-entity"); | |
el.setAttribute("text","value", desc); | |
// ToDo : find the right template or extends Hubs NAF schemas for text. | |
el.setAttribute("position", "0 2 0"); | |
AFRAME.scenes[0].appendChild(el); | |
// not networked for now, so limited to 1 person! | |
// for static text this is "solved" by being directly in the room code | |
// thus shared to all participants. | |
}).catch(function (err) { | |
console.warn('Fetch error:', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment