在Android浏览器链接并不总是执行的onClick造成焦点,而不是 [英] In Android Browser link does not always execute onClick causing focus instead

查看:242
本文介绍了在Android浏览器链接并不总是执行的onClick造成焦点,而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想程序使用HREF链接一个非常标准的JS行为 onclick处理程序,而我面对由什么原因引起我认为是在Android对焦/触摸模式行为,一个奇怪的问题。

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?).

伪code现在的问题是

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.

推荐答案

尝试在web视图中启用JavaScript。

Try enabling Javascript on the webview.

在保存web视图的活动,试试这个......

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

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

我有他同样的问题,但想通了,那是因为我没有启用JavaScript。

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

这篇关于在Android浏览器链接并不总是执行的onClick造成焦点,而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆