*BROWSER |
Chromium Browser Object |
Initializes Browser Object: |
DEF OBJECT obj_id,@(col,ln,wth,ht ){, |=}"*BROWSER" |
Where: |
|
*BROWSER |
Keyword used in defining PxPlus Chromium Browser Object. |
@(col,ln,wth,ht) |
Numeric expressions. Column and line coordinates for top left corner, width in number of columns and height in number of lines. |
obj_id |
Numeric variable that will be used to save the object reference. |
This object allows you to embed a Chromium Browser into PxPlus windows. Use this object to display a Web page, execute JavaScript, and subscribe to browser events.
If loading a Web page that has a certificate error (i.e. self-signed, expired, etc.), a warning will display. It will describe the certificate error and give the option to either go back to safety or proceed to the URL that has the error. The warning may be avoided if the server is added to the exceptions list. See CertErrExceptions$ property.
(The Chromium Browser object was added in PxPlus 2017.)
(Support for ignoring certificate errors was added in PxPlus 2022.)
The 'BI' system parameter controls whether or not the embedded Chromium browser runs in incognito mode. If running in incognito mode, the browser does not store or cache anything. This system parameter defaults to On, indicating that all Chromium browsers created will be in incognito mode.
(The 'BI' parameter was added in PxPlus 2017 Update 0001.)
The language of the embedded browser will be based on the Windows user language. This can be overridden by specifying the language code of the desired language in the BrowserLang INI setting or 'OPTION' mnemonic. See the Language Codes table for a list of supported languages and codes.
(Embedded browser support of other languages was added in PxPlus 2019.)
If *BROWSER Debug mode is On, the browser developer console will display in a popup window for *BROWSER controls that are created. The browser developer console makes it possible to examine the code and properties of the Web page loaded by the *BROWSER control and debug any errors. Debug mode can be set in the BrowserDebug INI setting or 'OPTION' mnemonic.
(The *BROWSER Debug mode was added in PxPlus 2021.)
A Find( ) method is provided that opens a Find dialog for searching text in a *BROWSER displayed Web page. By default, no hot key is assigned to the Find dialog. A FindHotKey property gives you the option to enable the standard hot key Ctrl+F, define a custom hot key (e.g. Ctrl+S) or have no hot key. The Find( ) method makes it possible for developers to add their own menus and buttons for opening the Find dialog.
(The Find( ) method and FindHotKey property were added in PxPlus 2021 Update 2.)
The first *BROWSER created by a process will initialize the language and incognito settings for all embedded chromium browsers created by the process. These settings cannot be changed on the fly; i.e. changing the setting after the first *BROWSER has been created will have no effect.
For information on adding a Chromium Browser control to a NOMADS panel, see COM Control.
The interface supports the following properties:
Property |
Description |
Gets/Sets a comma-separated list of servers where certificate errors are ignored. You must only specify the server portion of the URL. Example: For the URL https://home.pvxplus.com/pgsrvr.pvp?pg=products, the server portion is only home.pvxplus.com: "localhost,127.0.0.1,192.168.1.100,home.pvxplus.com" This property can also be set to "All" to ignore certificate errors on any server. For security reasons, this is not recommended unless the *BROWSER control is only loading pages locally and not from the Internet. (The CertErrExceptions$ property was added in PxPlus 2022.) | |
Col |
Gets/Sets the position of the left side of the embedded browser (in columns) from the left side of the panel. |
Cols |
Gets/Sets the width of the embedded browser (in columns). |
Document |
Access the document object (HTML DOM) of the active URL. For details on the HTML DOM, visit http://www.w3schools.com/jsref/default.asp. Note: |
Gets/Sets whether the browser allows drag and drop into the browser control or popup windows. (Support to allow drag and drop was added in PxPlus 2021.) | |
Used to set the hot key for opening the Find dialog (if applicable). See Find( ) method. Set this property to 1 to enable the standard Ctrl+F Find hot key or leave it set to 0 (default) if no hot key will be used. Alternatively, a custom Find hot key can be defined using this format: DEC("char") Where: char is a single alpha character ("A" to "Z"), enclosed in quotes. Example: To set Ctrl+S as the Find hot key: dec("S") (The FindHotKey property was added in PxPlus 2021 Update 2.) | |
Height |
Gets/Sets the height of the embedded browser (in pixels). |
History |
Access the various browser BOM objects. For details on the browser BOM objects, visit http://www.w3schools.com/jsref/default.asp. Note: |
Left |
Gets/Sets the position of the left side of the embedded browser (in pixels) from the left side of the panel. |
Line |
Gets/Sets the position of the top of the embedded browser (in lines) from the top of the panel. |
Lines |
Gets/Sets the height of the embedded browser (in lines). |
Returns the PxPlus class object that is handling events or returns a list of events names (depending on $ suffix) for the object. Note: | |
PvxExtData[$] |
Returns zero or an empty string. (Included for Shell.Explorer Compatibility) (Support for the numeric PvxExtData[$] property was added in PxPlus 2020 Update 1.) |
Title$ |
Gets the title of the resource that is currently loaded in the embedded browser. Note: |
Top |
Gets/Sets the position of the top of the embedded browser (in pixels) from the top of the panel. |
URL$ |
Gets/Sets the URL or path of the resource that is currently loaded in the embedded browser. |
Width |
Gets/Sets the width of the embedded browser (in pixels). |
The interface supports the following methods:
Method |
Description | ||||||||||
ExecJS[$](JavaScript$) |
Executes JavaScript$ in the currently loaded resource of the embedded browser and returns the result, if any. Note: | ||||||||||
Find( ) |
Opens the Find dialog, which allows users to search for specified text within the contents of a *BROWSER displayed Web page. The FindHotKey property is used to set or not set a Find hot key for opening this dialog.
This dialog consists of the following:
(The Find( ) method was added in PxPlus 2021 Update 2.) | ||||||||||
GoBack( ) |
Navigates the embedded browser backward to the previously loaded URL. | ||||||||||
GoForward( ) |
Navigates the embedded browser forward to the URL loaded before a GoBack( ). | ||||||||||
Navigate(url$) |
Navigates the embedded browser to a resource identified by url$, which could be a URL or a full path. | ||||||||||
Saves the current contents of the browser as a PDF file. Where: PdfPath$ is the path that the PDF will be saved as. (The PrintToPDF method was added in PxPlus 2023.) | |||||||||||
Refresh( ) |
Reloads the resource that is currently loaded in the embedded browser. | ||||||||||
Stop( ) |
Cancels a pending navigation or download and stops dynamic page elements such as background sounds and animations. |
The interface supports the following events:
Event |
Description | ||||||||||||||
BeforeNavigate(pDisp, url, flags, targetFrameName, postData, headers, cancel) |
This event is fired just before the embedded browser navigates to a new resource URL.
To use a reference to a variant object, you must first perform a DEF OBJECT on it to convert it to a PxPlus *VARIANT object. Once you have a *VARIANT object, you can use the VAL property to access what the variant stores. Warning! | ||||||||||||||
DownloadBegin( ) |
This event is fired just before the embedded browser begins a download. | ||||||||||||||
DownloadComplete( ) |
This event is fired just after the embedded browser completes a download. | ||||||||||||||
TitleChange(newTitle$) |
This event is fired just after the embedded browser has its title changed to newTitle$. |
The following code will give you an example of embedding a Chromium Browser in your panel and loading a Web page:
def object mySite,@(20,5,40,20),"*BROWSER"
mySite'Url$="www.mysite.com"
This table lists supported languages and codes:
Language Name |
Language Code |
Amharic |
am |
Arabic |
ar |
Bengali |
bn |
Bulgarian |
bg |
Catalan |
ca |
Chinese (Mainland China) |
zh-CN |
Chinese (Taiwan) |
zh-TW |
Croatian |
hr |
Czech |
cs |
Danish |
da |
Dutch |
nl |
English (United Kingdom) |
en-GB |
English (United States) |
en-US |
Estonian |
et |
Filipino |
fil |
Finnish |
fi |
French |
fr |
German |
de |
Greek (Modern) |
el |
Gujarati |
gu |
Hebrew (Modern) |
he |
Hindi |
hi |
Hungarian |
hu |
Indonesian |
id |
Italian |
it |
Japanese |
ja |
Kannada |
kn |
Korean |
ko |
Latvian |
lv |
Lithuanian |
lt |
Malay |
ms |
Malayalam |
ml |
Marathi |
mr |
Norwegian (Bokmål) |
nb |
Persian |
fa |
Polish |
pl |
Portuguese (Brazil) |
pt-BR |
Portuguese (Portugal) |
pt-PT |
Romanian |
ro |
Russian |
ru |
Serbian |
sr |
Slovak |
sk |
Slovenian |
sl |
Spanish |
es |
Spanish (Central and South America) |
es-419 |
Swahili |
sw |
Swedish |
sv |
Tamil |
ta |
Telugu |
te |
Thai |
th |
Turkish |
tr |
Ukrainian |
uk |
Vietnamese |
vi |
(Embedded browser support of other languages was added in PxPlus 2019.)
DEF OBJECT Define Windows Object
DELETE OBJECT Remove Windows Object
ON EVENT Event Processing
Apostrophe Operator
*VARIANT Extended Object
NOMADS COM Control
'BI' Browser Incognito Mode