Setting the Browser Title from a Scene's Name


You can set the HTML Page title for all scenes by editing the input field in the Document Inspector:

To change the title displayed in the browser based on the scene name, run the following JavaScript ‘On Scene Load’:

document.title = hypeDocument.currentSceneName();

If you want to use custom text (not the scene name), use this code:

document.title = "Custom Text Goes Here"

By default, the HTML Page title will be the name of your document if you don’t provide one.


hello ,

thank you for the answer but actualy , it doesn’t work for me …
Any Clue ?

(Mark Hunte) #3

This clue is it does not work for you because you have not followed the answer but instead made up some code that does not reflect the answer above!!! :open_mouth:

Have another look at the code above and try it.


You must use

document.title = hypeDocument.currentSceneName(); // to use the scene name as a title.
document.title = "A Name or a String"; // This is to manually set it.

document.title = hypeDocument.documentName(); // if you want to use the name that the document is saved as

The methods in the Hype API only return the document name or scene name. Your code above is incorrect. You cannot set anything using that method.

Les méthodes de l’API Hype ne renvoient que le nom du document ou le nom de la scène. Votre code ci-dessus est incorrect. Vous ne pouvez pas ** configurer ** n’importe quoi en utilisant cette méthode.