Contents - Index - Top


SetVirtualHostNameToFolderMapping

Interface AntView 

 

Type: Method

Parameters:  String hostName String folderPath TxHostResourceAccessKind accessKind

Returns: nothing

 

 

Map a virtual host Name to a folder Path in the current file system.

 

Use ClearVirtualHostNameToFolderMapping to remove the folder mapping.

 

Below is an example in DataFlex on how-to set the "rijksmuseum.local" domain hostname to a local folder on the file system that can look like "C:\Users\Public\Documents\DataFlex Demo\AppHtml\"

    

    Procedure OnComCreateWebviewCompleted Integer llHResult

      Boolean bIsCreated

      String sPath

      

      Get ComWebViewCreated to bIsCreated

      If (bIsCreated) Begin

        Get psAppHtmlPath of (phoWorkspace(ghoApplication)) to sPath

        Send ComSetVirtualHostNameToFolderMapping "rijksmuseum.local" sPath OLEhrakAllow

      End

    End_Procedure

 

or in Visual Basic:

    Private Sub MapLocalFolderToHostName()

      Dim Path As String

      Dim HostName As String

      

      Path = strGetVisualBasicDemoPath & "\html"

      HostName = "rijksmuseum.local"

      EdgeWebBrowser.SetVirtualHostNameToFolderMapping HostName, Path, hrakAllow

    End Sub

    

    Private Sub EdgeWebBrowser_OnCreateWebviewCompleted(ByVal HResult As Long)

      If EdgeWebBrowser.WebViewCreated = True Then

        MapLocalFolderToHostName

      End If

    End Sub

 

You are free to choose any domain name for the hostname. It does not have to represent an existing domain name, or even a hostname with an existing tld. In fact we would recommend to not use an existing domain name so that there won't be a conflict at any time in the future. You might even want to choose an imaginary tld in order to avoid the issue mentioned below. 

The hostname however should follow the basic format of a domain name, which can also include the host part, so it is in fact a FQDN.

 

 

A currently known issue with the .local TLD is that it can add an additional 2 second delay on resolving the first time.

See also:  MS Edge WebView2 github issue #2381

 

Example:

VB6 Web Browser Example

 


AntView - The MS Edge WebView2 ActiveX control Date last changed: 04/16/2025