-
Notifications
You must be signed in to change notification settings - Fork 2
Loading HTML
In the following code snippets, the HTML file is stored under app/chromely.html
. 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 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 see.
class Program
{
static int Main(string[] args)
{
string startUrl = "https://google.com";
//...
}
}
For more information please visit Chromely Apps.
This is the preferred way of loading local HTML5 files.
You can either:
- Use the default local resource scheme handling or create a custom one. (Please see samples - CefSharp, CefGlue)
- Use the default scheme handler or registering a new one.
class Program
{
static int Main(string[] args)
{
string startUrl = "local://app/chromely.html";
var config = ChromelyConfiguration
.Create()
//...
.UseDefaultResourceSchemeHandler("local", string.Empty);
//Or register new resource handler
//RegisterSchemeHandler("local", string.Empty, new CustomResourceHandler())
//...
}
}
class Program
{
static int Main(string[] args)
{
string startUrl = "local://app/chromely.html";
var config = ChromelyConfiguration
.Create()
//...
.UseDefaultHttpSchemeHandler("http", "chromely.com")
//Or register new http scheme handler
//RegisterSchemeHandler("http", "example.com", new CustomHttpHandler())
//...
}
}
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.
You can either:
- Use the default local resource scheme handling or create a custom one. (Please see samples - CefSharp, CefGlue)
- Use the default scheme handler or registering a new one.
class Program
{
static int Main(string[] args)
{
var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
string startUrl = $"file:///{appDirectory}app/chromely.html";
var config = ChromelyConfiguration
.Create()
//...
.UseDefaultResourceSchemeHandler("local", string.Empty);
//Or register new resource handler
//RegisterSchemeHandler("local", string.Empty, new CustomResourceHandler())
//...
}
}
class Program
{
static int Main(string[] args)
{
var appDirectory = AppDomain.CurrentDomain.BaseDirectory;
string startUrl = $"file:///{appDirectory}app/chromely.html";
var config = ChromelyConfiguration
.Create()
//...
.UseDefaultHttpSchemeHandler("http", "chromely.com")
//Or register new http scheme handler
//RegisterSchemeHandler("http", "example.com", new CustomHttpHandler())
//...
}
}
Chromely
Getting Started
The Basics
Digging Deeper
- Sub-Process
- Infrastructure
- Restful Resources
- Register Resource Assemblies
- Custom Local Resource Handling
- Custom Scheme Handling
- Expose .NET class to JavaScript
- Generic Message Routing
- Real-time with Websocket
- External Url Registration
Angular - React - Vue