Phonegap application unexpectedly restarts

I have a strange problem with the Phonegap Android app. I have a button with ontouchend='dosomeajax()'.

If I execute the function through the console of the remote inspector, everything goes fine, but if I click on the button, the function unexpectedly returns an ajax error and restarts (reloads the main html page).

D/com.appgyver.preview.ESWebViewClient( 3632): shouldInterceptRequest: http://myserver.com/action.php
D/com.appgyver.preview.ESWebViewClient( 3632): onLoadResource: http://debug.phonegap.com/ws/target/112xxxxx4
D/com.appgyver.preview.ESWebViewClient( 3632): onLoadResource: http://myserver.com/action.php
D/com.appgyver.preview.ESWebViewClient( 3632): shouldOverrideUrlLoading: http://localhost/index.html, http://localhost/index.html?
D/com.appgyver.preview.ESWebViewClient( 3632): Overriding url loading for http://localhost/index.html?

What's wrong?

+4
source share
1 answer

Please show how you declare a button if it is something like this:

<a href="#" ontouchend="dosomeajax()">click me</a>

possibly hrefstarting a page reload. Just remove href or make it href="javascript:false;"or so.

+2
source

Source: https://habr.com/ru/post/1545822/


All Articles