Wix.Utils

getCacheKiller

getCacheKiller() → String

Returns a String which is the cacheKiller query parameter.

Example:

getCompId

getCompId() → String

Returns a String which represents the component’s iframe component id.

Note:
Trying to use this method in the settings endpoint? To get the compId of the component that opened the settings endpoint, use getOrigCompId.

Example:

getDeviceType

getDeviceType() → String

Returns a String which represents the current device type: Desktop or Mobile

Example:

getInstanceId

getInstanceId() → String

Returns a String which represents the app instance Id.

Example:

getInstanceValue

getInstanceValue(String) → {*}

Returns the current value of the requested key. If the key does not exist, null is returned.

Example:

getIpAndPort

getIpAndPort() → String

Returns a String which represents the app IP and port.

Example:

getLocale

getLocale() → String

Returns a String which represents the current locale of the website or editor (en (English), es (Spanish), fr (French), it (Italian), etc.).

A locale is an abbreviated language tag that defines the user’s language, country and any special variant preference of the user interface (e.g. Number format, Date format, etc.).

Example:

getOrigCompId

getOrigCompId() → String

Returns a String which represents the iframe’s component id which opened the App Settings panel.

Example:

getPermissions

getPermissions() → String

Returns a String which represents the user’s permissions (decoded property of the instance query parameter).

Example:

getSectionUrl

getSectionUrl([sectionIdentifier], [callback]) 

Use this method if you have a page component and you’re using server-side rendering to create deep links for internal pages.

This method returns the URL of your page component in the live site, for example: mysite.com/my-store-app. You’ll use this URL to build the URLs for the app’s internal pages, for example: mysite.com/my-store-app/product1.

Important:
Use this method in the live site only. Although it works in the Editor/Preview, it returns the URL of the iframe itself – not the page URL in the site.

Parameters:

NameTypeDescription

Example:

eComm app directs a site visitor to a thank-you page after a purchase:

getSignDate

getSignDate() → String

Returns a string which represents the signDate of the app instance.

 Example:

getSiteOwnerId

getSiteOwnerId() → String

Returns a string that represents the site owner’s ID.

Returns:

The site owner’s ID.

Example:

getTarget

getTarget() → String

Returns a string which is the target query parameter (for the section-url). If it does not exist, returns null.

Example:

getUid

getUid() → String

Returns a string which represents the user identifier.

 Example:

getViewMode

getViewMode() → String

Returns a string which represents the current view mode.

Example:

getWidth

getWidth() → Number

Returns a number which represents the iframe’s width.

Example:

navigateToSection

navigateToSection(options, onFailure)

Navigates to your page component – either to the page component itself or to one of your app’s internal pages.

To navigate to a widget or fixed-position widget, use Wix.navigateToComponent instead.

Parameters:

NameTypeDescription

Example:

Note:
This method is not available from the Dashboard endpoint.
toWixDate

toWixDate() → String

Converts a JavaScript Date object into the correct format, ISO 8601, used by Wix APIs when dealing with dates.

Media.getAudioUrl

Media.getAudioUrl(relativeUri) → String

Constructs the absolute URL for an audio file in the Wix Media Manager.

Warning:
Use this method each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription

Returns:

A full URL pointing to the audio file hosted on Wix static servers.

Example:

Media.getDocumentUrl

Media.getDocumentUrl(relativeUri) → String

Constructs a URL for a media item of type document.

Warning:
Use this method each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription

Returns:

A full URL pointing to the Wix static servers of a document media file with the default dimensions.

Example:

Media.getImageUrl

Media.getImageUrl(Image) → String

Constructs a URL for a media item of type image.

On the live site, we recommend using Media.getResizedImageUrl instead (for better performance).

Warning:
Use this method each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription

Returns:

A full URL pointing to the Wix static servers of an image with the default dimensions – width and height.

Example:

Media.getResizedImageUrl

Media.getResizedImageUrl(relativeUrl, width, height, [sharpParams]) → String

Constructs a URL for a media item of type image. You can change the image dimensions as well as its sharpening properties. Learn more about sharpening.

Warning:
Use this method each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription

Returns:

A full URL pointing to the Wix static servers of an image with the custom dimension parameters.

Example:

Media.getSwfUrl

Media.getSwfUrl(relativeUri) → String

Constructs a URL for a media item of type swf.

Warning:
Use this method each time you access the media item, to prevent broken links.

Parameters:

Name TypeDescription

Returns:

A full URL pointing to the Wix static servers of a swf media file with the default dimensions.

Example:

Was this page helpful?

What can we do to improve it?

What did you like about it?