Web browser is a special container for showing web-content. This is an ideal option for displaying information in a complex format, displaying on-line pages and etc.

Web browser is presented by FGX.WebBrowser.TfgWebBrowser class in FGX Native.


Loading local HTML page

If you need to create HTML page locally or you would like to load local HTML page from file. You can use TfgWebBrowser.LoadHTML method.

Tracking URL loading

TfgWebBrowser supports set of events for tracking stages of loading resources:

  1. OnStartLoading - specified resource by URL is being start loading
  2. OnFinishLoading- specified resource by URL is loaded
  3. OnErrorLoading - specified error was occured, when browser loads specified URL.

You can stop loading resource in any time by invoking TfgWebBrowser.StopLoading method. Also you can reload resource by TfgWebBrowser.Reload.

Evaluating Javascript

TfgWebBrowser supports work with Javascript. It can evealuate your Javascript code and return result back to you.

It's a simple code snippet shows getting current document URL via Javascript:

Overriding Url loading

If you want to intercept loading URL, you can use OnDecideLoadUrl event.

You have an article loaded from a local file with pictures and you want to implement a preview of the images used in the article. You can add links to each images with URL and intercept clicking at this links in OnDecideLoadUrl event. This event allows decline loading resource by url.

Scroll

Web browser has a set of methods and event for scrolling content.

  1. ScrollBy - scrolls content on specified offset.
  2. ScrollTo - scrolls content to specified offset.
  3. ScrollTop - scroll content to the beginning.
  4. ScrollBottom - scroll content to the end.
  5. ContentSize - size of loaded content.
  6. ContentOffset - current content offset.