webflow.closeExtension()

Close the Designer Extension using the Webflow object.

Syntax

1webflow.closeExtension(): Promise<null>

Returns

Promise<null>

A Promise that resolves to null.

Example

This ReactJSexample shows how to close the extension using a button.

1function CloseExtensionButton() {
2 const handleCloseExtension = async () => {
3 try {
4 await webflow.closeExtension();
5 console.log("Extension closed successfully.");
6 } catch (error) {
7 console.error("Failed to close the extension:", error);
8 }
9 };
10
11 return (
12 <button onClick={handleCloseExtension}>
13 Close Extension
14 </button>
15 );
16}