Hello, is it possible to obtain the showroom title in the body-end html? At the moment I’ve been obtaining it by getting the url and splitting it from there, but since urls can change I wondered if there is a more reliable way of getting it.
If you set the scene Title in the Viewer tab, you will be able to access the title as document.title
. Could it work for you?
Hi, sorry for this late response. I tested getting the document title after changing the title in the viewer tab. It seems to only return 3D scene.
Could you share a link to the scene showing this issue? You can use forum’s PM if the scene is not public.
Hi, so it seems that the problem only occurs in local testing. I uploaded the showroom and saw that it does get the title correctly in the live showroom.
I tested in this test showroom just in case you still wanted to see it:
edit I’ll send it in pm
So it works great! Thanks for the solution
Thanks for the update. Locally, document.title
is set to the title of the scene, however, it’s done dynamically, after the cover.json
file is fetched. If you need this property for local development, you can postpone accessing document.title
until the scene is ready to display - the callbacks registered by Viewer.onSceneReadyToDisplay
are called at that time: GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene.