The main form of the Sample contains a TWebBrowser component that supports the basic functions of a web browser, such as: navigate to URL, go back and go forward.
In this post, you’ll learn how to easily load and display Web Content Cross-Platform In Delphi On Android and IOS using Cross-Platform App Builder.
Table of Contents
Location
You can find the WebBrowser sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
Object PascalMobile SnippetsWebBrowser
CPPMobile SnippetsWebBrowser
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
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.
Files
The project consists of one source file, uMain.pas, that contains the class for the main form that represents the user interface.
Classes
- WebBrowserForm is the main form that represents the main window, and it contains the following components:
- TWebBrowser called WebBrowser1.
- TStatusBar called StatusBar1.
- TToolBar called TToolbar1.
- TButton called btnGO.
- TClearingEdit called edtURL.
Implementation
- 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.
Please follow the link below for more information in the original post of the Sample:
http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.WebBrowser_Sample
Head over and check out the full source code for the TWebBrowser sample on GitHub.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition