This sample depicts how to use a TWebBrowser component using FireMonkey.
You can find the WebBrowser sample project at:
- Start | Programs | Embarcadero RAD Studio Rio | Samples and navigate to:
Object Pascal\Mobile Snippets\WebBrowser
- Subversion Repository:
This application creates a form that permits loading and displaying web content or local files.
The main form contains a TWebBrowser component that supports the basic functions of a web browser, such as: navigate to URL, go back and go forward.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: WebBrowser.dproj.
- C++: WebBrowser.cbproj.
- Press F9 or choose Run > Run.
The project consists of one source file, uMain.pas, that contains the class for the main form that represents the user interface.
- WebBrowserForm is the main form that represents the main window, and it contains the following components:
- The TWebBrowser component calls the Navigate method in order to load and display the content associated with an URL address or a file name.
- The TClearingEdit component gets the URL address or file name.
- The btnGo button implements an OnClick event in order to call the event-handler that sets the URL property of the WebBrowser1. Setting this property allows TWebBrowser to automatically call the Navigate method.
- The btnForward button implements an OnClick event to call the event-handler that calls the GoForward method to navigate to the next URL address or file name in the browsing history list, if any.
- The btnBack button implements an OnClick event to call the event-handler that calls the GoBack method to navigate to the previous URL address or file name in the browsing history list, if any.