This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
How to Execute Custom Functions Inside a WebView
Camilo Castro edited this page Dec 4, 2020
·
2 revisions
In this example (Based on Code by DAN
) we are defining a custom function that calls
the window.history.back()
method inside the $webcontainer
webview.
Using the $agent.request
API.
This method will be executed when the layer
label is clicked.
The $agent.response()
is needed in order to continue the normal flow of events.
We are using Arrow Functions
to simplify the syntax.
Tip: You can also trigger a reload using location.reload() or any JS browser function.
Note: Note that we are not using templates ({}
).
{
"$jason": {
"head": {
"title": "History Go Back",
"description": "Triggers a History Back on Button Press",
"actions": {
"navigate_back": {
"type": "$agent.request",
"options": {
"id": "$webcontainer",
"method": "(() => window.history.back(); $agent.response();)"
}
}
}
},
"body": {
"layers": [
{
"type": "label",
"text": "<",
"style": {
"size": "45",
"top": "100%-50",
"left": "0",
"align": "center",
"width": "20%",
"color": "#ffffff",
"background": "#2C2C2C"
},
"action": {
"trigger": "navigate_back"
}
}
],
"background": {
"type": "html",
"url": "https://www.google.com",
"action": {
"type": "$default"
}
}
}
}
}
- Telegram: https://t.me/jasonelle
- Website: https://jasonelle.com
- Additional: https://jasonelle-archive.github.io/docs/legacy/