Loading Html - RupertAvery/Chromely GitHub Wiki

Start url can be set in 3 different ways: Using real website url, loading files with custom resource handling and using file protocol (file:///).

/*
* Start url (load html) options:
*/

// Options 1 - real standard urls 
string startUrl = "https://google.com";

// Options 2 - using local resource file handling with default/custom local scheme handler 
// Requires - (sample) UseDefaultResourceSchemeHandler("local", string.Empty)
//            or register new resource scheme handler - RegisterSchemeHandler("local", string.Empty,  new CustomResourceHandler())
string startUrl = "local://app/chromely.html";

// Options 3 - using file protocol - using default/custom scheme handler for Ajax/Http requests
// Requires - (sample) UseDefaultResourceSchemeHandler("local", string.Empty)
//            or register new resource handler - RegisterSchemeHandler("local", string.Empty,  new CustomResourceHandler())
// Requires - (sample) UseDefaultHttpSchemeHandler("http", "chromely.com")
//            or register new htpp scheme handler - RegisterSchemeHandler("htpp", "test.com",  new CustomHttpHandler())
string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
string startUrl = $"file:///{appDirectory}app/chromely_with_ajax.html";

Real Website Url

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.

Local Resource Loading with a Custom Scheme Handler

This is the preferred way of loading local HTML5 files.

This will require:

  • creating custom local resource scheme handling. Please see samples - CefSharp, CefGlue.
  • registering default scheme handler or registering a new one.

File Protocol

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.

This will require:

  • creating custom http scheme handling. Please see samples - CefSharp, CefGlue.
  • registering default scheme handler or registering a new one.
⚠️ **GitHub.com Fallback** ⚠️