getAppPageUrl( )


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

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.

Method Declaration
Copy
function getAppPageUrl(pageId: string): Promise<string>;
Method Parameters
pageIdstringRequired

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

Returns
Return Type:Promise<string>
Retrieve the new page's URL and go to that page
JavaScript
import wixApplication from "wix-application"; import wixLocation from "wix-location"; //... wixApplication .getAppPageUrl("Page ID") .then((url) => { if (url) { wixLocation.to(url); } else { console.log("Page doesn't exist"); return; } }) .catch((error) => { console.error(error); // Handle the error });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?