public class BrowserWidget extends Canvas:
Embedded HTML/CSS/JS document viewer implemented by the Klyn GUI stack.
BrowserWidget provides local and remote navigation, history, link activation, scrolling, page zoom, images and a deterministic DOM scripting profile without adding a third-party browser dependency. Its retained display list keeps scrolling and repainting independent from HTML parsing and CSS layout. Documents without an explicit CSS font use the same default font and size as the active menu-bar theme.
import klyn.gui.windows.browser
browser = BrowserWidget("file:///opt/klyn/docs/api/index.html")
browser.navigationFailed += lambda(event: BrowserNavigationErrorEvent): print(event.message)| Modifier and Type | Member | Description |
|---|---|---|
| public property | allowScriptsallowScripts as Boolean: |
Whether inline and external scripts may use the embedded DOM profile. |
| public readonly property | canGoBackcanGoBack as Boolean: |
Whether goBack() can select an older history entry. |
| public readonly property | canGoForwardcanGoForward as Boolean: |
Whether goForward() can select a newer history entry. |
| public readonly property | documentTitledocumentTitle as String: |
Current document title. |
| public readonly property | historyhistory as BrowserHistory: |
Navigation history retained by this browser. |
| public property | homeUrlhomeUrl as String: |
URL opened by goHome(). |
| public readonly property | isLoadingisLoading as Boolean: |
Whether a page is currently loading in the background. |
| public readonly property | scrollXscrollX as Int: |
Horizontal document scroll position in CSS pixels. |
| public readonly property | scrollYscrollY as Int: |
Vertical document scroll position in CSS pixels. |
| public readonly property | statusTextstatusText as String: |
Current status text, usually the link under the pointer. |
| public property | userStyleSheetuserStyleSheet as String: |
CSS rules supplied by the host application for the displayed document. |
| public property | zoomFactorzoomFactor as Double: |
Page-specific zoom factor, clamped to 0.25 .. 5.0. |
| Modifier and Type | Member | Description |
|---|---|---|
| public signal property | urlurl as String: |
Current effective document URL. |
| Modifier and Type | Member | Description |
|---|---|---|
| public event | documentCompleteddocumentCompleted as BrowserNavigationEvent |
Emitted after styles, scripts and layout are ready for painting. |
| public event | navigatednavigated as BrowserNavigationEvent |
Emitted after the main page and blocking resources have loaded. |
| public event | navigatingnavigating as BrowserNavigationEvent |
Emitted immediately before a navigation starts. |
| public event | navigationFailednavigationFailed as BrowserNavigationErrorEvent |
Emitted when the requested document cannot be loaded. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | BrowserWidgetBrowserWidget(url as String = "about:blank"): |
Creates an embedded browser and optionally starts navigation. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | executeScript | Executes the embedded DOM scripting profile against the current page. |
| public | goBackgoBack() as Boolean: |
Navigates to the previous history entry. |
| public | goForwardgoForward() as Boolean: |
Navigates to the following history entry. |
| public | goHomegoHome() as Void: |
Navigates to homeUrl. |
| public | navigatenavigate(url as String) as Void: |
Starts asynchronous navigation to an absolute URL, relative URL or path. |
| public | navigateToString | Loads an in-memory HTML document without filesystem or network access. |
| public override | paintpaint(painter as Painter) as Void: |
Paints the retained browser display list. |
| public | refreshrefresh() as Void: |
Reloads the current URL without adding a history entry. |
| public | scrollBy | Scrolls relative to the current CSS-pixel position. |
| public | scrollTo | Scrolls the document to CSS-pixel coordinates. |
| public | stopstop() as Void: |
Cancels the active network or file navigation. |