0
I have this simple search engine, works on all browsers, even on android Chrome, but does not work on Webviews, any suggestion of what might be and if there is any other compatible code that can replace this, target
and action
for example, and how to enable this for webview??
<form align="center" method="GET">
<input type="text" placeholder="Digite Sua Pergunta Aqui" autofocus name="query" size="50">
<input type="submit" onclick="myFunction()" value="Buscar">
</form>
<script>
function myFunction() {
var query = document.getElementsByName('query')[0];
window.open("endereco_site" + query.value);
}
</script>
You are enabling Javascript in Webview?
– Valdeir Psr
What behavior do you expect? I mean, where will this window open? will exit the app and go to the browser?
– David Schrammel
@Valdeirpsr in the case is the user who will have to enable this?
– Miguel Silva
@Miguelsilva No, you are the developer. For Javascript to work, the developer must assign the value
true
in the methodwebView.setJavaScriptEnabled
(in the case of Android). And how you are usingpopup
, maybe there is also why (I did not test something like).– Valdeir Psr
@Davidschrammel is an app that opens a page using webview, when the user types the question and clicks to search it opens another page with the search result, only webview instead of appearing the text field and Submit appear two fields followed by java script code like this:
function myFunction() {
 var query = document.getElementsByName('query')[0];
 window.open("endereco_site" + query.value);
 }
– Miguel Silva
@Valdeirpsr got it right
– Miguel Silva
You can do this without javascript?
– Miguel Silva
@Miguelsilva Using modal
– Valdeir Psr