onChange( )


Adds an event handler that runs when an application page's URL changes.

The event handler set by the onChange() function runs when the location is changed but the change doesn't trigger navigation. This situation occurs when navigating between subitems on a page that is managed by a full-page application.

For example, a store product page is a full-page application. When a product page's path changes because it is switching between items, no actual navigation is taking place. You can use the onChange() event handler to determine when a new product is displayed and perform any necessary partial updates on the current page.

について onChange() function can only be used when browser rendering happens, meaning you can only use it in frontend code after the page is ready.

To determine if a page is managed by a full-page application, use the wixサイトフロントエンド currentPage property or getSiteStructure() function to retrieve a StructurePage object that corresponds to the page. If the object contains an applicationId value, then the page is managed by a full-page application.

メソッド宣言
コピー
メソッド・パラメータ
handlerfunctionRequired

handler(event: Location): void The name of the function or the function expression to run when the location changes.

役に立ちましたか?
はい
いいえ