Embedding Microsoft Dynamics NAV Web Client Pages in Other Websites

The Microsoft Dynamics NAV Web client can be deployed as an independent website. In some cases, it is useful to embed parts of the Microsoft Dynamics NAV Web client in other websites, for example, in order to build an internal company portal that not only contains data from Dynamics NAV, but also contains news feeds, document handling, and so on

You can do this by adding an iframe element on the embedding website, such as: <iframe src=”https://MyWebServer/DynamicsNAV110/default.aspx?...” /> or <iframe src=”https://MyWebServer/DynamicsNAV100/WebClient/default.aspx?...” /> (for Microsoft Dynamics NAV 2017 and earlier versions). The Microsoft Dynamics NAV Web client will display the ribbon, the navigation pane, and other UI parts inside the frame. You can update the Microsoft Dynamics NAV Web client to hide the ribbon, the navigation pane, or any UI parts, and only display the core part of the list inside the frame.

Note

In Dynamics NAV, only list pages are supported as framed pages.

Important

Certain data in the URL, such as company name, could be considered sensitive information. Use discretion if you distribute URLs that contain the company name, or if it is possible, exclude this information from the address.

Important

Upcoming releases of some browsers, such as Google Chrome 80 and Microsoft Edge, will include changes to how cookies are handled. To ensure that the embedded web client works with these browser versions, make sure that the Dynamics NAV platform has been upgraded to a recommended update version as described in Preparing Dynamics NAV or Dynamics 365 Business Central for Upcoming Changes to Browser Cookie Policy.

Example

The following URL displays page 22 Customers for the CRONUS International Ltd. Company. The page is displayed in a Microsoft Dynamics NAV Web client that is running on a computer that has the name MyWebServer. The page is displayed without the ribbon, the navigation pane, and any UI parts.

https://MyWebServer/nav_server_instance/?company=CRONUS%20International%20Ltd.&page=22&showribbon=0&shownavigation=0&showuiparts=0  

Or, for Microsoft Dynamics NAV 2017 and earlier versions:

https://MyWebServer/nav_server_instance/WebClient/default.aspx?company=CRONUS%20International%20Ltd.&page=22&showribbon=0&shownavigation=0&showuiparts=0  

For more information about the page address syntax, see Opening a Page in the Microsoft Dynamics NAV Web Client by Using a URL.

iframe Parameters

The following table describes the parameters of the URL for displaying a list page in an iframe.

Parameter Description
http&#124;https Specifies the Internet protocol to use. Valid options are http and https.

The https protocol helps secure the Microsoft Dynamics NAV data that is transmitted over the Internet. To use https, Secure Sockets Layer (SSL) must be enabled on the connection to the Microsoft Dynamics NAV Web client. For more information, see How to: Configure SSL to Secure the Connection to Microsoft Dynamics NAV Web Client.
webserver Specifies the name of the computer that is running the Microsoft Dynamics NAV Web client.
webserverinstance Specifies the name of the web server instance for the Microsoft Dynamics NAV Web client.

On IIS, this is the alias of the virtual directory of the web server instance. When you install the Microsoft Dynamics NAV Web client using Microsoft Dynamics NAV Setup, the web server instance is given the same name as the Microsoft Dynamics NAV Server instance that it connects to. If you use the New-NAVWebServerInstance cmdlet to add Microsoft Dynamics NAV Web client instances, then you specify the web server instance name. For more information, see How to: Set Up Multiple Web Server Instances for the Microsoft Dynamics NAV Web Client.
default&#124;blank Specifies the name of the active server page file to use to display the page. You can use either of the following types, regardless of the page type: default, blank.
company The name of the company in Dynamics NAV for which you want to display the page. If you do not select a company, then Microsoft Dynamics NAV Web client uses the company that is defined in the configuration file. If no company is defined in the configuration file, then the last company opened by the user is displayed.
mode Specifies the mode in which to display the page.

- View
The page can only be viewed. The user cannot change data on the page.
- Edit
The user can change data on the page.
- Create
Opens a blank page that enables the user to create a new item.
showribbon Specifies whether to show the ribbon when the specified page opens. The default value, if the parameter is not specified, is 1, which displays the ribbon. Use the value 0 if you do not want to show the ribbon. Important: The showribbon parameter cannot be used to hide the app bar, use the isembedded parameter instead.
shownavigation Specifies whether to show the navigation page when the specified page opens. The default value, if the parameter is not specified, is 1, which displays the navigation pane. Use the value 0 if you do not want to show the navigation pane.
showuiparts Specifies whether to show UI parts when the specified page opens. The default value, if the parameter is not specified, is 1, which displays the UI parts. Use the value 0 if you do not want to show UI parts.
isembedded Specifies the navigational behavior of the Microsoft Dynamics NAV Web client. If the Microsoft Dynamics NAV Web client is run as part of an external web site, the isembedded parameter can be used to specify that the Microsoft Dynamics NAV Web client opens in full screen mode when activated.

Use the Back button on the web browser to return from a list. If a card was activated, the original web site is rendered when the card is dismissed.

The default value, if the parameter is not specified, is 0, which displays the Microsoft Dynamics NAV Web client in a non-embedded manner. Use the value 1 if you want to show the Microsoft Dynamics NAV Web client embedded and in full screen mode, when activated. Important: Specifying the value 1 for isembedded will also hide the app bar.
pagesize Specifies the number of lines to display in a grid control, which is useful when embedding the Microsoft Dynamics NAV Web client.

The default value, if the parameter is not specified, is 20.

Embedding the Microsoft Dynamics NAV Web Client in a Website on Another Web Server

By default, the Microsoft Dynamics NAV Web client will not allow a website to display the web client inside an iframe unless the website is hosted on the same web server.

In order to show a list page in an HTML site on a different host, the configuration file of the Dynamics NAV Web Server instance that hosts the Microsoft Dynamics NAV Web client(includes/nav_web_md.md)] has to be configured to include a hostname as a value of the AllowedFrameAncestors setting.

"NAVWebSettings":  {  
    "AllowedFrameAncestors":  "https://myhostname.com",
    ...  
    }
}

Warning

The value of AllowedFrameAncestors accepts wildcards. If you want to specify more hostnames, the values must be separated by commas.

In the following some sample values for AllowedFrameAncestors are shown:

 "AllowedFrameAncestors":  "https://mysite.sharepoint.com,https://yoursite.sharepoint.com",  
"AllowedFrameAncestors":  "https://*.myportal.com",  

See Also

How to: Open the Microsoft Dynamics NAV Web Client