AboutSupportDeveloper GuideVersion 38.126.83.80

User-facing options for a view.

interface ViewOptions {
    accelerator?: Partial<Accelerator>;
    api: ApiSettings;
    autoResize: AutoResizeOptions;
    autoplayPolicy: AutoplayPolicyOptions;
    backgroundColor: string;
    bounds: Bounds;
    chromiumPolicies: ChromiumPolicies;
    closeBehavior: "destroy" | "hide" | "detach";
    contentCreation: ContentCreationOptions;
    contentNavigation: NavigationRules;
    contentRedirect: NavigationRules;
    contextMenu: boolean;
    contextMenuOptions: ContextMenuOptions;
    contextMenuSettings: ContextMenuSettings;
    customContext: any;
    customData: any;
    customRequestHeaders: CustomRequestHeaders[];
    detachOnClose: boolean;
    downloadShelf: {
        enabled: boolean;
    };
    enableBeforeUnload: boolean;
    excludeOptions: ExcludeOptions;
    experimental: any;
    fdc3InteropApi?: string;
    hotkeys: Hotkey[];
    interop?: InteropConfig;
    isClosable: boolean;
    manifestUrl: string;
    name: string;
    permissions: Partial<Permissions>;
    preloadScripts: PreloadScript[];
    preventDragOut: boolean;
    processAffinity: string;
    target: Identity;
    throttling: ViewThrottling;
    url: string;
    zoomLevel: number;
}

Properties

accelerator?: Partial<Accelerator>

Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.

Configurations for API injection.

autoResize: AutoResizeOptions
autoplayPolicy: AutoplayPolicyOptions

Autoplay policy to apply to content in the window, can be no-user-gesture-required, user-gesture-required, document-user-activation-required. Defaults to no-user-gesture-required.

backgroundColor: string

The view’s backfill color as a hexadecimal value. Not to be confused with the content background color (document.body.style.backgroundColor), this color briefly fills a view’s (a) content area before its content is loaded as well as (b) newly exposed areas when growing a view. Setting this value to the anticipated content background color can help improve user experience. Default is white.

bounds: Bounds

Initial bounds given relative to the window.

chromiumPolicies: ChromiumPolicies

Control behavior for Chromium policies

closeBehavior: "destroy" | "hide" | "detach"

Platforms Only. Determines what happens when a view is closed in a platform window. Supersedes the deprecated detachOnClose. If not set, detaults to destroy if detachOnClose is false (default), or detach if detachOnClose is true. While this option is not updateable, it may change at runtime if detachOnClose is updated. 'hide' hides the view on the platform window that closed it. 'detach' behaves like 'detachOnClose': true. It attaches the closed view to the platform provider. 'destroy' is the default behavior as long as 'detachOnClose' is not set. It destroys the view.

contentCreation: ContentCreationOptions

Configures how new content (e,g, from window.open or a link) is opened.

contentNavigation: NavigationRules

Restrict navigation to URLs that match an allowed pattern. In the lack of an allowlist, navigation to URLs that match a denylisted pattern would be prohibited. See here for more details.

contentRedirect: NavigationRules
contextMenu: boolean

Deprecated

Superseded by contextMenuOptions, which offers a larger feature-set and cleaner syntax.

Default Value

true

Show the context menu when right-clicking on the view.
Gives access to the devtools for the view.
contextMenuOptions: ContextMenuOptions

Configure the context menu when right-clicking on a window.

contextMenuSettings: ContextMenuSettings

Deprecated

Superseded by contextMenuOptions, which offers a larger feature-set and cleaner syntax.

Configure the context menu when right-clicking on a window.

customContext: any

A field that the user can use to attach serializable data that will be saved when Platform.getSnapshot is called. If a window in a Platform is trying to update or retrieve its own context, it can use the Platform.setWindowContext and Platform.getWindowContext calls. When omitted, inherits from the parent application. As opposed to customData, this is meant for frequent updates and sharing with other contexts. For usage example, see customContext Example.

customData: any

A field that the user can attach serializable data to be ferried around with the window options. When omitted, inherits from the parent application.

customRequestHeaders: CustomRequestHeaders[]

Custom headers for requests sent by the view.

detachOnClose: boolean

Default Value

false

Deprecated

Platforms Only. If true, will hide and detach the View from the window for later use instead of closing, allowing the state of the View to be saved and the View to be immediately shown in a new Layout.

downloadShelf: {
    enabled: boolean;
}

Controls interaction of the view with its parent window's download shelf.

Type declaration

  • enabled: boolean

    Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow.

    Remarks

    If enabled: true, downloads from this view will cause the download shelf to display on the parent window even if that parent window's DownloadShelfOptions specify enabled: false.

enableBeforeUnload: boolean

Default Value

false

When set to true, any beforeunload handler set on Views will fire.

excludeOptions: ExcludeOptions

Control which options to ignore when creating a Platform View.

experimental: any
fdc3InteropApi?: string
hotkeys: Hotkey[]

Defines the hotkeys that will be emitted as a hotkey event on the view. For usage example, see hotkeys Example. Within Platform, OpenFin also implements a set of pre-defined actions called keyboard commands that can be assigned to a specific hotkey in the platform manifest.

interop?: InteropConfig
isClosable: boolean

Default Value

true

Platforms Only. If false, the view will be persistent and can't be closed through either UI or Platform.closeView. Note that the view will still be closed if the host window is closed or if the view isn't part of the new layout when running Layout.replace.

manifestUrl: string

Platforms Only. Url to a manifest that contains View Options. Properties other than manifestUrl can still be used but the properties in the manifest will take precedence if there is any collision.

name: string

The name of the view.

permissions: Partial<Permissions>

API permissions for code running in the view.

Remarks

Superseded by DomainSettings.default.api.permissions - if present, this setting will be ignored. It is recommended for users to migrate to a domain-based security model, since it is more natural to assign trust to the source of the page content than to the context rendering it.

preloadScripts: PreloadScript[]

Scripts that run before page load. When omitted, inherits from the parent application.

preventDragOut: boolean

Default Value

false

**Platforms Only.** If true, the tab of the view can't be dragged out of its host window.
processAffinity: string

String tag that attempts to group like-tagged renderers together. Will only be used if pages are on the same origin.

target: Identity

The identity of the window this view should be attached to.

throttling: ViewThrottling

View throttling state.

  • enabled: Both background throttling and scheduler throttling are true. It's fully throttled.
  • scheduler-disabled: background throttling is true, but scheduler throttling is disabled.

Default Value

'enabled'
url: string

Default Value

"about:blank"

The URL of the window
zoomLevel: number