UCefView
Loading...
Searching...
No Matches
Resource Mapping

UCefView provides several methods for loading web resources, usually you just need to set the Url property to load the online or local file resource.

  • Load Online Web Resource: Load resources directly from the web by specifying a URL.
  • Load Local File With File Path: Load local files by providing the file path.

Sometimes you may need to load a fully self-hosted web application. In this case, you can leverage the resource mapping feature of UCefView to make it easy.

Resource mapping means you can add a mapping rule from local file (directory/zip file) to a specified URL then just navigate to the URL appending with the relative file path to access it in UCefView.

UCefView provide two mapping approaches: FArchiveFileResourceMapping and FLocalFolderResourceMapping

Archive File Mapping

Map a local archive file (e.g., ZIP) to a custom Url, allowing you to access the resources in the archive file with your custom Url.

For example, you have a zip file webres.zip with built front-end resource in it.

full/path/to/webres.zip
│ index.html
├───assets
├───docs
├───img

You can create a FArchiveFileResourceMapping item with the following values either by C++ code or Blueprint:

ArchiveMapping.Url = TEXT("https://your.site.com");
ArchiveMapping.Path = TEXT("full/path/to/webres.zip");
Represents a mapping from an archive file to a URL for resource loading.
Definition CefViewTypes.h:213
FString Url
The target URL to be mapped to.
Definition CefViewTypes.h:223

Then just navigate to your web application with https://your.site.com/index.html in UCefView.

Local Folder Mapping

Map a local folder to a custom Url, allowing you to access the resources in the local directory with your custom Url.

For example, you build the WebApp project and get the output folder webres, the folder structure is as follows:

full/path/to/webres
│ index.html
├───assets
├───docs
├───img

Create a FLocalFolderResourceMapping item with the following values either by C++ code or Blueprint:

FolderMapping.Url = TEXT("https://your.site.com");
FolderMapping.Path = TEXT("full/path/to/webres");
Represents a mapping from a local folder to a URL for resource loading.
Definition CefViewTypes.h:150
FString Url
The target URL to be mapped to.
Definition CefViewTypes.h:160

Then just navigate to https://your.site.com/index.html in UCefView to access your web resource.

Reference