Android WebView : disable geo: for addresses

巧了我就是萌 提交于 2020-01-04 06:15:52

问题


In my Android application, I am using a WebView to render a list of locations. For some reason, when I click on a list item, it interprets it as a "geo:" address and opens the default browser to show the location. How can I configure the WebView to not interprete the location's addresses.

I don't want the "geo:" handling to swallow the "normal" list item touch event. If I tap carefully just on the location name then the "normal" list item touch event is fired. The WevView must interprete addresses automatically, since I don't add the "geo:" markup.

Sample content:

Southport Open Storage
3080 Promenade St, West Sacramento, CA 95691, USA

Sample content html:

<li class="ui-li ui-li-static ui-body-c">
 <span class="location-address-name">D And L Heating And Air - HVAC Contractor</span><br>
 <span class="location-formatted-address">3236 Malcolm Island St, West Sacramento, CA 95691, USA</span>
</li>

Additional Info:

  • Using jQueryMobile 1.0-b2 to for all UI components
  • jQuery 1.6.2

I saw some posts about "geo:" but they mostly dealt with WebViewClient.shouldOverrideUrlLoading(...) which seems no relevant to the above issue.


回答1:


Looks like you want to add this to your <head>:

<meta name="format-detection" content="address=no" />

See also this similar question:

  • Disable the automatic Linkify of Webview


来源:https://stackoverflow.com/questions/7053861/android-webview-disable-geo-for-addresses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!