Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
webview_flutter - Javascript event works on browser but not on app webview

I'm using the official "webview_flutter" plugin, and I want to modify a form that will be sent to a server. This is the code that I have in my flutter app to programmatically modify form values: (It modifies the value but it sends an empty form to the server)

void _setFormLocationHistory() async {
sleep(Duration(seconds: 1));

await _webViewcontroller.runJavascriptReturningResult(
    'var event = new Event("change", {bubbles: true,});var this_input = document.getElementsByName("/awLRwRXn4GTpdcq3aJE2WQ/Location_History")[0];this_input.value = "test";this_input.dispatchEvent(event);');
print("Location History updated in webview.");
  }

This is the form that I want to fill programmatically (both from a browser view and from the app view): enter image description here

However, if I copy and paste the same exact code on my browser console (from pc instead of app), then it gets sent to server correctly. I want the app to work the same way the pc-browser works.

enter image description here This is the results that I receive in the server. From the app I get an empty string while from browser I get "test2"

enter image description here

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda