Warning: This feature is deprecated. If you have any questions or need assistance, contact us.
A page extension is a full page, customisable element that's added to the user's live site. It can appear in the main navigation menu and behaves just like any other page.
It can have internal pages, each with its own URL, so it’s ideal for apps that use deep linking (like a blog, forum, or ecommerce store).
In this article we'll tell you about all the things to keep in mind when developing a page extension to help you deliver the best possible experience for users.
Here's some useful things to know about a page extension:
A page extension is made up of two parts:
Note:
Both of these will need to contain our JavaScript SDK, or else they won't load. Read more about our SDK here.
When a user adds your app, we’ll generate a unique ID for your app for this specific site – this is the App Instance ID. You should use this to link your app to this site.
This ID is sent to you as part of the App Instance query parameter, which is a signed parameter that allows you to identify the website and the Wix user, and verify that the calling party is indeed Wix.
All of your app’s endpoints will have the same App Instance ID, so each request sent to the page endpoint and to the App Settings endpoint includes the same App Instance ID in the iframe URL.
To build a page extension, you'll need to create an App Settings panel. Here are some things you should do to create an optimal App Settings experience:
When users change a setting in your app, update the app right away in the Wix Editor – but don’t change the app on the live site until the user publishes the site. Here’s how:
SITE\_SAVED
event in the addEventListener method. If the user doesn’t save the site, discard the latest changes and go back to the previous settings the next time we call your app endpoint.SITE\_PUBLISHED
event in the addEventListener method. When SITE\_PUBLISHED
is issued, update the app in the live site.When users change your app’s settings, here’s how to update your app right away in the Wix Editor:
1. Detect changes that the user makes in the App Settings panel: Use the onChange or onClick function. 2. Update your database/backend server immediately 3. Show the changes in your app: for a better user experience, don’t refresh your app – here’s what to do instead:
SETTINGS\_UPDATED
event.Users can only add a page app once from the App Market. If users want to add secondary pages to the main page extension, it's possible for them to add them directly from your App Settings panel. For example, an ecommerce app may want to allow users to set up a few stores on their site.
Here's how to support multiple page extensions in a site:
Note:
Use the getOrigCompId method to identify the page extension that opened the App Settings panel – this returns the compId of the page, so you can open the right settings panel.
Follow our UI/UX guidelines for your page extension’s size:
A page extension supports deep linking for its internal pages. There are two supported forms of deep linking you can use: server-side rendering and AJAX rendering. You can also combine the two.
Note:
The section-url parameter referenced in this document refers to the page iframe URL.
For AJAX apps, deep linking enables your app to update the content of your iframe without refreshing the whole iframe.
Your page extension changes its state using JavaScript and AJAX methods. After the page extension changes its state, it notifies the host website using the Wix.pushState() JavaScript method. This call will not reload your iframe. Wix will update the top window App-state part of the page URL, allowing it to be shared or copied and pasted to other locations.
Example:
If the browser is showing this URL: https://site.domain.com/page-title/App-state-1
when you call the method: pushState(“App-state-2”)
the browser URL will change to https://site.domain.com/page-title/App-state-2
, but your page iframe will not reload.
When a user shares or copies and pastes a link, and there’s a resultant request to render a page with a deep-linked URL state of your page extension, Wix will call your page with the internal state as part of the iframe’s URL in the App-state path variable. You should load your page extension at the intended internal page state.
Example:
When a user clicks on a link with a URL such as: https://site.domain.com/page-title/App-state
Wix will reload the page iframe using the URL: https://your-section-endpoint-url/App-state?rest-of-the-parameters
Deep linking for server-side apps enables your page extension to render different pages depending on the App-state path of your iframe.
A page extension supports deep linking using this flow:
section-url
should be the base URL for your internal pages, and the target parameter should be used as the target attribute of anchor tags.section-url
as the URL of the page extension website page, and the target as \_top
.history-changed
event and will update the page iframe URL, setting the App-state path parameter to the value “Appended by the App” to the section-url
parameter.Example
Assume that there is a Wix website with the domain www.domain.com, which has a page extension on the page www.domain.com/page-title. Also assume that the page endpoint is www.App.com.
Note:
The section-url parameter will be URL encoded. This example is not encoded for readability purposes.
Using this flow, your page extension will reload in the iframe with the new URL.
Page apps must be fully optimized for search engine crawlers, to improve SEO for your users. There are two main steps to optimize your app:
Follow these dos and don’ts to optimize your app for search engines.
Do:
Manage internal pages in your app the right way:
h1
only for internal pages: For the app’s main page, don’t use h1. Use h2, h3, and so on, according to your app’s hierarchy.Don't:
Create a separate HTML file for the SEO endpoint. Your SEO endpoint should be an “HTML snapshot” – a stripped down version of your app that has all the static HTML content visible on the user’s site, and none of the JavaScript or dynamic functionality.
Here are some important things to keep in mind when creating your SEO endpoint:
App HTML
SEO Endpoint
App HTML
SEO Endpoint
You can see what your app looks like to a search engine crawler – whether or not you developed a dedicated SEO endpoint by accessing the site / page with a Googlebot.
Here’s how to do it in Google Chrome:
For browsers like Edge, Firefox and Safari, check out this article.
Create a mobile endpoint for your app so that it works well on mobile devices. This endpoint should have the same functionality as your web app – except for these differences:
URL Requirements
Page request URL template
Name | Value | Comments |
---|---|---|
endpoint | The Widget URL as provided in the app dashboard | |
app-state | The inner state of the page extension | The app-state part of the URL may include a query string, but must not include a # |
instance | The signed instance | |
section-url | The base URL of the page extension | |
target | Attribute that must be added to all href anchors within the page iframe | |
width | The width of the iframe in pixels | Note that the frame height will auto-adjust depending on the frame content |
cacheKiller | The cacheKiller is there to ensure no caching of the iframe content by the host browser | |
compId | The ID of the extension | While the instanceId remain constant within the scope of the site, each iframe will have a unique and persistent compId |
viewMode | Current view mode | "editor" or "site". "editor" is valid inside the Wix editor, while "site" is available only in a published website |
locale | Current locale value | |
deviceType | Current device type | "desktop" or "mobile" |
App Settings request URL template
Name | Value | Comments |
---|---|---|
endpoint | The App Settings URL as provided in the app dashboard | |
instance | The signed instance | |
width | The width of the iframe in pixels | |
compId | The compId value for the app settings is always tpaSettings | |
origCompId | The ID of the extension which associated with the App Settings | The origCompId identifies the current extension that the user is editing |
locale | Current locale value |
It's really important to make sure your app is secure and protects the user's privacy. We've got a dedicated guide to help you with this.