browserLocale


browserLocalestringRead-only

Gets the locale of a site visitor's browser.

A locale, also known as an IETF language tag, is an abbreviated code that defines the language, country, and other aspects of a site visitor's browser, such as number format and date format.

Some common locales include:

  • "en-US": English, United States
  • "en-GB": English, British
  • "es-ES": Spanish, Spain
  • "de-DE": German, Germany
  • "ja-JP": Japanese, Japan
  • "fr-CH": French, Switzerland
  • "it-IT": Italian, Italy
Get the locale of a site visitor's browser
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... let browserLocale = wixWindowFrontend.browserLocale; // "en-US"
Did this help?

formFactor


formFactorstringRead-only

Gets what kind of device is being used to view a page.

Note: This property only checks a site visitor's device, and not which Studio Editor's breakpoint they are using.

The formFactor property gets one of:

  • "Desktop": When viewed in a desktop browser.
  • "Mobile": When viewed in a mobile browser.
  • "Tablet": When viewed in a tablet browser.

Important: Some tablet devices (such as iPads) are identified in this property as "Desktop".

Get a device's form factor
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... let formFactor = wixWindowFrontend.formFactor; // "Mobile"
Did this help?

referrer


referrerstringRead-only

Gets the HTTP referrer header field.

The referrer is the address of the web page a site visitor was previously on before arriving at the current page, typically by clicking a link.

Note: When site visitors move from page to page within your site, the referrer property does not contain the address of the page the site visitor came from. This is because Wix sites are built as single page applications. To get the previous page a site visitor was visiting within your site, you can use wix-storage-frontend to store the visitor's current page and retrieve the visitor's previous page.

JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... let referrer = wixWindowFrontend.referrer; // "http://somesite.com"
Did this help?

viewMode


viewModestringRead-only

Gets which mode a site is currently being viewed in.

The viewMode property gets either:

  • "Preview": When previewing a site using the Preview button in the editor.
  • "Site": When viewing a published site.
  • "Editor": When viewing a Wix Blocks built widget in the editor.
Get a window's view mode
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... let viewMode = wixWindowFrontend.viewMode; // "Site"
Did this help?

copyToClipboard( )


Copies text to a site visitor's clipboard.

The copyToClipboard() method copies the specified text to a site visitor's clipboard.

If a site visitor's browser doesn't support copying text to the clipboard programmatically, a modal popup that allows copying will be displayed. For example, when calling copyToClipboard() from a Firefox or Edge browser, a site visitor will see something similar to the popup shown below.

Copy To Clipboard Popup

The Promise returned by copyToClipboard() resolves when the specified text is copied to clipboard or the modal popup is closed. The Promise is rejected if a null value is passed as the toCopy parameter or if a site visitor's browser blocks the modal popup from opening.

Method Declaration
Copy
function copyToClipboard(text: string): Promise<void>;
Method Parameters
textstringRequired

The text to copy.

Copy text to clipboard
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... wixWindowFrontend .copyToClipboard("Text to copy!") .then(() => { // handle case where text was copied }) .catch((err) => { // handle case where an error occurred });
Did this help?

getAppPageData( )


Gets the data passed to a custom app page.

Wix passes data to custom app pages that you can use when implementing a page's business logic. Call the getAppPageData() method to retrieve the data and use it in your code. The data retrieved by this method is different for each type of custom app page. For more information, see App Page Data.

Learn more about building custom app pages.

Note: If you call getAppPageData() for a page that isn't a custom app page, it returns null.

Method Declaration
Copy
function getAppPageData(): object;
Request
This method does not take any parameters
Returns
Return Type:
Get the data passed to a custom app page
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... let appData = wixWindowFrontend.getAppPageData(); // {nextSection: {sectionId: "Booking Form"}}
Did this help?

getBoundingRect( )


Gets information about a window.

Returns information about a window's size, document's size, and current scroll position.

This method returns null for sites with SSR.

Method Declaration
Copy
function getBoundingRect(): Promise<WindowSizeInfo>;
Request
This method does not take any parameters
Returns
Return Type:Promise<WindowSizeInfo>
Get information about a window
JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... wixWindowFrontend.getBoundingRect().then((windowSizeInfo) => { let windowHeight = windowSizeInfo.window.height; // 565 let windowWidth = windowSizeInfo.window.width; // 1269 let documentHeight = windowSizeInfo.document.height; // 780 let documentWidth = windowSizeInfo.document.width; // 1269 let scrollX = windowSizeInfo.scroll.x; // 0 let scrollY = windowSizeInfo.scroll.y; // 120 });
Did this help?