openWebResource (Client API reference)

Applies to Dynamics 365 (online), version 9.x

Opens an HTML web resource.

Syntax

Xrm.Navigation.openWebResource(webResourceName,windowOptions,data)

Parameters

Name Type Required Description
webResourceName String Yes Name of the HTML web resource to open.
windowOptions Object No Window options for opening the web resource. The object contains the following attributes:
- height: (Optional) Number. Height of the window to open in pixels.
- openInNewWindow: Boolean. Indicates whether to open the web resource in a new window.
- width: (Optional) Number. Width of the window to open in pixels.
data String No Data to be passed into the data parameter.

Remarks

You must use this method to display web resources instead of the deprecated Xrm.Utility.openWebResource method.

An HTML web resource can accept the parameter values described in Pass parameters to HTML web resources. This function only provides for passing in the optional data parameter. To pass values for the other valid parameters, you must append them to the webResourceName parameter.

Examples

  • Open an HTML web resource named “new_webResource.htm”:

    Xrm.Navigation.openWebResource("new_webResource.htm");

  • Open an HTML web resource, setting the windowOptions:

    var windowOptions = { openInNewWindow: true, height: 400, width: 400 }
    Xrm.Navigation.openWebResource("new_webResource.htm",windowOptions);
    
  • Open an HTML web resource including a single item of data for the data parameter

    Xrm.Navigation.openWebResource("new_webResource.htm",null,"dataItemValue");

Xrm.Navigation