On this page:
A Racket GUI widget to display web pages
web-view%
new
set-url
get-url
go-forward
go-back
reload
set-html-text
7.4

A Racket GUI widget to display web pages

Andre Alves Garzia

 (require web-view) package: web-view

This module contains a Web View to be used with Racket GUI Toolkit. At the moment it works only with macOS because it wraps WKWebView from WebKit.

There is a Demo Browser available on the Github Repository.

class

web-view% : class?

  superclass: object%

A widget to display web pages.

constructor

(new web-view% 
    [parent parent] 
    [[on-status-change on-status-change]]) 
  (is-a?/c web-view%)
  parent : 
(or/c (is-a?/c frame%)
      (is-a?/c dialog%)
      (is-a?/c panel%)
      (is-a?/c pane%))
  on-status-change : ((is-a?/c button%) (is-a?/c control-event%) . -> . any)
   = (lambda (b e) (void))
Construct a new widget.

The on-status-change procedure is used to receive navigation events from the web view.

method

(send a-web-view set-url url)  any/c

  url : string?
Set the URL for the web view.

method

(send a-web-view get-url)  string?

Get the current URL loaded in the web view.

method

(send a-web-view go-forward)  any/c

Navigates forward.

method

(send a-web-view go-back)  any/c

Navigates backward.

method

(send a-web-view reload)  any/c

Reloads the current page.

method

(send a-web-view set-html-text text    
  base-url)  any/c
  text : string?
  base-url : string?
Sets the HTML text being used by the web view. Any relative url will be relative to the specified base url.