Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Android Browser link does not always execute onClick causing focus instead

I am trying to program a very standard JS behavior for a link using an HREF onClick handler, and I am facing a strange problem caused by what I believe to be focus/touch mode behavior on Android.

Sometimes when I click on the link, instead of executing the action, it simply becomes selected/focused, with either just a focus rectangle or even also with a filled focus rectangle (selected as opposed to just focused?).

The pseudo-code right now is

<a href="#" onClick="toggleDivBelowToShowHide(); return false;">go</a>

I have tried doing something like:

<a href="#" onTouchStart="toggleDivBelowToShowHide(); return false;">go</a>

But I still get the same pesky problem some of the time.

like image 886
Artem Avatar asked Feb 02 '10 17:02

Artem


1 Answers

Try enabling Javascript on the webview.

In the activity that holds the webview, try this...

WebView wv = (WebView) findViewById(R.id.webview);
wv.getSettings().setJavaScriptEnabled(true);

I was having he same problem, but figured out it was because I did not enabled Javascript.

like image 192
Pulkit Sethi Avatar answered Sep 28 '22 23:09

Pulkit Sethi