Web Viewer Component
Overview
The web viewer component displays websites in your app. You can also use it to run HTML and JavaScript commands. For example, you can run a simple HTML URL to decode an image into base 64 text.
Some websites may not appear when previewing your app on the web. We recommend previewing with the Thunkable Live app on a device.
Properties
Web Viewer
Property | Description | Data Type |
---|---|---|
URL | Set the initial URL to be displayed in the web viewer. The URL should begin with HTTPS://. You can also type in the name of an HTML file that has been uploaded to the project to display in the web viewer. | URL |
Advanced Properties
Property | Description | Data Type |
---|---|---|
Geolocation Enabled (Android only) | Select if you want to enable geolocation functionality for Android apps. | True/False |
Layout
Property | Description | Data Type |
---|---|---|
X | The location of the top left corner of the web viewer is on the X-axis, where the left-hand side is X=0. | Number |
Y | The location of the top left corner of the web viewer on the Y-axis, where the top side is Y=0. | Number |
Height | Height of the web viewer in pixels. | Number |
Width | Width of the web viewer in pixels. | Number |
Resize Mode | Define dimensions of the web viewer component. | Select from list |
Style
Property | Description | Data Type |
---|---|---|
Visible | Toggle whether your end users can see the web viewer. | True/False |
Border Style | Set whether border style is solid, dotted or dashed (only visible if border width > 0) | Select from list |
Border Color | Color of border (only visible if border width > 0) | Color |
Border Width | Width of border around the web viewer in pixels. | Number |
Border Radius | Radius of corners of border on the web viewer in degrees. | Number |
Shadow Color | Color of the web viewer's shadow. | Color |
Shadow Opacity | Opacity of the web viewer's shadow. | Number between 0 and 100 |
Shadow Radius | Radius of corners of the web viewer's shadow in pixels. | Number |
Shadow Offset | How far the web viewer's shadow should be offset, in height and width, in pixels. | Number |
Web Viewer Blocks
Event Blocks
When Web Viewer Receives Message
The "when web viewer receives message" block fires when the web viewer receives a message from the web page it's displaying. It returns the "message" output, text that contains the message that was received.
Function Blocks
Call Web Viewer's Reload
The "call web viewer's reload" block reloads the web viewer.
Call Web Viewer's Back
The "call web viewer's back" block navigates the user back to the previous page visited.
Call Web Viewer's Forward
The "call web viewer's forward" block navigates the user to the next page in the user's browser history.
Call Web Viewer's Post Message
If you own the website displayed in the web viewer, you can send and receive messages between your website and the web viewer using Javascript. The "call web viewer's post message" block posts a message to the website.
You can see examples of sending and receiving messages and get further setup instructions here: Thunkable Web Viewer Extensions.
You may also find connecting to a Web API helpful for sending and receiving information between your app and a website.
Call Web Viewer's Value From Post Message
The "call web viewer's value from post message" block returns any message received after using the "call web viewer's post message" block.
Properties Blocks
There are two types of property blocks: dark green "set" and light green "get" blocks. The specific blocks available vary according to the UI component.
The dark green set blocks allow you to change the component's properties using blocks. For example, if you don't want a button to be enabled for a user until they've typed a set number of characters into a text input component, you can use the button's dark green set button's disabled status block.
The light green get blocks allow you to access the properties of a component (e.g. color, font, width, text, etc.).
Last updated