formFactor( )


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

Note: This property only checks the 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".

Method Declaration
Copy
function formFactor(): Promise<string>;
Request
This method does not take any parameters
Returns
Return Type:Promise<string>
Get a device's form factor
JavaScript
import { createClient } from "@wix/sdk"; import { site } from "@wix/site"; import { window as wixWindow } from "@wix/site-window"; const wixClient = createClient({ host: site.host(), modules: { wixWindow }, }); // ... let formFactor = await wixClient.wixWindow.formFactor(); // "Mobile"
Errors

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

Did this help?