diff --git a/docs/maps/api-reference.md b/docs/maps/api-reference.md index 9891a88a..80d57ea9 100644 --- a/docs/maps/api-reference.md +++ b/docs/maps/api-reference.md @@ -187,6 +187,25 @@ Example: WA.goToPage('https://www.wikipedia.org/'); ``` +### Going to a different map from the script + +``` + +goToRoom(url: string): void +``` + +Load the map at url without unloading workadventure + +relative urls: "../subFolder/map.json[#start-layer-name]" +global urls: "/_/global/domain/path/map.json[#start-layer-name]" + +Example: + +```javascript +WA.goToRoom('../otherMap/map.json'); +WA.goToRoom("/_/global/.json#start-layer-2") +``` + ### Opening/closing a web page in an iFrame ``` diff --git a/maps/tests/goToPageScript.js b/maps/tests/goToPageScript.js index af5b7f9f..bccbc5d2 100644 --- a/maps/tests/goToPageScript.js +++ b/maps/tests/goToPageScript.js @@ -39,7 +39,7 @@ WA.onEnterZone(zoneName, () => { label: "load grouped map", className: "popUpElement", callback: (popup => { - WA.exitSceneTo(urlRelativeMap); + WA.goToRoom(urlRelativeMap); popup.close(); })