-
Notifications
You must be signed in to change notification settings - Fork 277
Loading HTML
Note: In some of the following code snippets, the HTML file is stored under the folder app/
. It's not required to be under app/
. Feel free to create your file structure as you see fit, this is just an example.
This will launch actual website URL. This may not necessarily be commonly used as Chromely is focused on loading local HTML5 files for SPAs (Single Page Applications).
This URL should also be of scheme and domain combination that is not registered as external URL scheme. For external URL scheme registration, please Registering Url Schemes.
To load start url and its assets, you can configure it either in config file or via C# code.
- Using config file
"startUrl": {
"url": "https://google.com",
"loadType": "absolute"
}
- Using C# code
public class DefaultConfiguration : IChromelyConfiguration
{
public DefaultConfiguration()
{
StartUrl = "https://google.com";
}
}
This is the preferred way of loading local HTML5 files.
Loading html and associated files via LocalResource
needs a custom resource scheme handler. For more info on scheme handling, please see Registering Resource Handlers.
To load start url and its assets, you can do it either in config file or configuration object:
"startUrl": {
"url": "local://app/chromely.html",
"loadType": "localResource"
}
public class DefaultConfiguration : IChromelyConfiguration
{
public DefaultConfiguration()
{
StartUrl = "local://app/chromely.html";
}
}
Local HTML5 files can also be loaded using file protocol (file:///). Using file protocol (file:///) is discouraged for security reasons. One issue might be Cross-Origin domain. Although not the preferred way, it is useful if HTML/Ajax XHR requests are required.
To load start url and its assets, you can do it either in config file or configuration object:
"startUrl": {
"url": "app/chromely.html",
"loadType": "fileprotocol"
}
public class DefaultConfiguration : IChromelyConfiguration
{
public DefaultConfiguration()
{
var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
StartUrl = $"file:///{appDirectory}app/chromely.html";
}
}
Chromely
Getting Started
Networking
Resources
Debugging
Detailed documentation on:
- Getting Started
- Configuring Chromely
- Loading Html
- Resource Handling
- Configuring Message Routing
- Register Ajax/XHR Handlers
- JavaScript Execution
- Scheme Registration
- Scheme Handlers
- Custom Http Handlers
- How to use commands
- Custom CEF Handlers
- Chromely on Raspberry Pi
- How to use app settings
- CEF binaries download
- Using DevTools