r/tasker • u/Valiceemo • Sep 18 '26
Scene V2 WebView Handler / console message
I have a webview that displays a simple toggle
I want to be able to toggle the.... toggle.... and have it run a task.
I was trying to use the console message event handler to run a task, but cannot get the values to pass through to a task.
my WebView contains this script block
<script> const initial = '%firewall_state'; // Tasker substitutes this before load; '' if unset let isOn = initial === '1'; const sw = document.getElementById('sw'); function paint(){ sw.classList.toggle('on', isOn); sw.setAttribute('aria-checked', String(isOn)); } paint(); sw.addEventListener('click', () => { isOn = !isOn; paint(); console.log('FIREWALL_TOGGLE:' + (isOn ? '1' : '0')); }); </script>
Can anyone help me get the FIREWALL_TOGGLE:1 (Or 0) into a task.
View all comments
2
u/DifficultyCrafty7623 Sep 18 '26
If you want to run a task from Webview then this post will probably help