Search.../

getAppPageUrl( )

Gets the URL of the new page that was added by a Blocks app, when installed on a site.

Description

The getAppPageUrl() function returns a Promise that resolves to a string with a URL of the new page that was added by a Blocks app, when a widget is installed on a site as a new page. Learn more about app and widget installation settings.

Syntax

function getAppPageUrl(pageId: string): Promise<string>

getAppPageUrl Parameters

NAME
TYPE
DESCRIPTION
pageId
string

The ID of the page on which the widget is added, as defined in the Installation Settings.

Returns

Fulfilled - The page URL.

Return Type:

Promise<string>

Was this helpful?

Retrieve the new page's URL and go to that page

Copy Code
1import wixApplication from 'wix-application';
2import wixLocation from 'wix-location';
3
4//...
5
6wixApplication.getAppPageUrl('Page ID')
7 .then((url) => {
8 if (url) {
9 wixLocation.to(url);
10 } else {
11 console.log("Page doesn't exist");
12 return;
13 }
14 })
15 .catch((error) => {
16 console.error(error);
17 // Handle the error
18 });