JavaScript Bridge
Updating Navigation Drawer at Runtime
Dynamically update Navigation Drawer items, header, colors, position, visibility, and enabled state for the current Android app session.
Before you start
- A generated Android build that includes this runtime handler
- Website code that checks window.webtoapp before sending the message
Configure and verify
Detect the bridge
Check window.webtoapp.postMessage before sending native settings.
Send the drawer patch
Place drawer values under updates.modules.drawer-nav.settings. Unspecified dashboard values remain unchanged.
If the drawer is open, the app closes it safely before applying the new structure.
Keep saved defaults in the dashboard
Runtime changes last for the current app session. Relaunching the app restores the settings compiled into the APK.
Runtime example
webtoapp.postMessage(JSON.stringify({
type: "update_settings",
updates: {
modules: {
"drawer-nav": {
enabled: true,
settings: {
position: "left",
header_title: "Account",
items: [
{ icon: "e88a", title: "Home", action: "https://example.com" },
{ icon: "e0be", title: "Contact", action: "https://example.com/contact" }
]
}
}
}
}
}));Accepted names
Session scope
Test before release
- Bridge availability is checked
- Drawer items have valid URLs
- Left and right positions are tested
- Browser fallback remains usable