Page 1 of 1

webview questions

Posted: Sun Mar 30, 2025 9:02 pm
by Silvio.Falconi
I wish ask

if I can no show the menu when I click on html as

Image

I can use the command

Code: Select all | Expand

:InjectJavascript( "document.addEventListener('contextmenu', function(e) { if (e.target.tagName !== 'A') { e.preventDefault(); } });" )
and seems run ok obviously it is set so that if the mouse clicks on a link it executes it without problems


For ugrade html
is there a comand or I must call allways the command oApp():oDashboard:SetHtml( Html() )
or I can simulate ctrl+R ? as there is on menu ?
I can use f5 or

Code: Select all | Expand

:InjectJavascript( "document.addEventListener('keydown', function(e) { if (e.key === 'F5') { e.preventDefault(); window.location.reload(); } }); function refreshPage() { window.location.reload(); } document.addEventListener('DOMContentLoaded', function() { var refreshAreas = document.getElementsByClassName('refresh-area'); for (var i = 0; i < refreshAreas.length; i++) { refreshAreas[i].addEventListener('click', function() { refreshPage(); }); } });" )
any suggestions ?

SetUserAgent( cUserAgent )

How use this ? is there a sample test ?

Re: webview questions

Posted: Mon Mar 31, 2025 12:13 am
by cnavarro
SetUserAgent

Look this topic
viewtopic.php?p=278605#p278605

Re: webview questions

Posted: Mon Mar 31, 2025 8:19 pm
by Silvio.Falconi
cnavarro wrote: Mon Mar 31, 2025 12:13 am SetUserAgent

Look this topic
viewtopic.php?p=278605#p278605
Cris ¿qué debería hacer este agente? ¿Cual es su función?

Re: webview questions

Posted: Mon Mar 31, 2025 11:42 pm
by cnavarro
Silvio, te remito a la documentacion oficial, pero en algunos casos es muy util
https://developer.mozilla.org/en-US/doc ... User-Agent
El User-Agent es un encabezado HTTP que los navegadores (u otros clientes HTTP) envían al servidor web para identificar el dispositivo, sistema operativo, navegador y versión que está realizando la solicitud. Este encabezado permite que el servidor adapte su respuesta según las capacidades del cliente.
Gracias al encabezado que se envia con el user-agent puedes determinar el comportamiento de la aplicacion, son muchas las utilidades que tiene.
The User-Agent is an HTTP header that browsers (or other HTTP clients) send to the web server to identify the device, operating system, browser, and version making the request. This header allows the server to tailor its response based on the client's capabilities.
Thanks to the header sent with the user-agent, you can determine the application's behavior, and it has many uses.