Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
43 views1 page

Navigation - WorkAdventure Documentation

The document outlines the WorkAdventure APIs, focusing on the Map Scripting API and its functionalities such as navigating between maps, opening web pages in new tabs, and managing co-websites. It provides examples of how to use various API functions like WA.nav.openTab and WA.nav.goToRoom. Additionally, it includes information on redirecting users to the login page and managing iframe-based co-websites.

Uploaded by

raziq.brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Navigation - WorkAdventure Documentation

The document outlines the WorkAdventure APIs, focusing on the Map Scripting API and its functionalities such as navigating between maps, opening web pages in new tabs, and managing co-websites. It provides examples of how to use various API functions like WA.nav.openTab and WA.nav.goToRoom. Additionally, it includes information on redirecting users to the login page and managing iframe-based co-websites.

Uploaded by

raziq.brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Map Building Admin User Developer Tutorials Login Get Started Search ctrl K

WorkAdventure APIs Map Scripting API Api Reference Navigation


Opening a web page in a new tab
Inbound API
Opening a web page in the current tab
Map Scripting API Navigation Going to a different map from the script

Variables Opening/closing web page in Co-Websites

Get all Co-Websites


Events Opening a web page in a new tab
Redirecting user to the "login" page
Api Reference
WA.nav.openTab(url: string): void
Camera

Chat
Opens the webpage at "url" in your browser, in a new tab.
Controls
Example:
Event

Map Editor API


WA.nav.openTab('https://www.wikipedia.org/');
Metadata

Navigation
Opening a web page in the current tab
Player

Players WA.nav.goToPage(url: string): void

Room
Opens the webpage at "url" in your browser in place of WorkAdventure. WorkAdventure will be completely unloaded.
Sound

Start Example:

State
WA.nav.goToPage('https://www.wikipedia.org/');
UI

Deprecated Functions

Extended utility functions


Going to a different map from the script
Scripting Internals
WA.nav.goToRoom(url: string): void
Using Typescript

Map Storage API Move the user to another room.

Room API
Relative urls: "../subFolder/map.json[#start-layer-name]"
Global urls: "/_/global/domain/path/map.json[#start-layer-name]"

Example:

WA.nav.goToRoom("/@/tcm/workadventure/floor0") // workadventure urls


WA.nav.goToRoom('../otherMap/map.json');
WA.nav.goToRoom("/_/global/<path to global map>.json#start-layer-2")

INFO

You can also teleport a player to a specific entry point of the current map using a hash:

// Let's teleport the player to the entry named "my-entry-point"


WA.nav.goToRoom("#my-entry-point");

Opening/closing web page in Co-Websites

WA.nav.openCoWebSite(url: string, allowApi?: boolean = false, allowPolicy?: string = "", percentWidth?: numbe

Opens the webpage at "url" in an iFrame (on the right side of the screen) or close that iFrame. allowApi allows the webpage to use the
"IFrame API" and execute script (it is equivalent to putting the openWebsiteAllowApi property in the map). allowPolicy grants
additional access rights to the iFrame. The allowPolicy parameter is turned into an allow feature policy in the iFrame,widthPercent
define the width of the main cowebsite beetween the min size and the max size (70% of the viewport), position in whitch slot the web
page will be open, closable allow to close the webpage also you need to close it by the api and lazy it's to add the cowebsite but don't
load it.

Example:

const coWebsite = await WA.nav.openCoWebSite('https://www.wikipedia.org/');


const coWebsiteWorkAdventure = await WA.nav.openCoWebSite('https://workadventu.re/', true, "", 70, 1, true, t
// ...
coWebsite.close();

Get all Co-Websites

WA.nav.getCoWebSites(): Promise<CoWebsite[]>

Get all opened co-websites with their ids and positions.

Example:

const coWebsites = await WA.nav.getCoWebSites();

Redirecting user to the "login" page

WA.nav.goToLogin(): Promise<void>

Closes WorkAdventure and opens the login page in your browser.

CAUTION

If you are using the self-hosted version of WorkAdventure, the call will fail if no OpenID provider is configured.

Example:

await WA.nav.goToLogin();

Edit this page

Previous Next
« Metadata Player »

Docs Need help ? Follow us

Map Building Book a demo Linkedin

Admin Discord Twitter


Developer GitHub Facebook

Copyright © 2024 workadventu.re - All Rights Reserved

You might also like