3

I would like to catch local anchor clicks. These anchors are local within the page i.e., href="#link_1". What is the best way to catch these clicks? OverrideURL does not fire on them? I am loading a new page based on the anchor href.

Kanth
  • 6,681
  • 3
  • 29
  • 41
SoundsDangerous
  • 708
  • 6
  • 13
  • 1
    I'm debating adding a javascript interface to deal with each anchor click. This seems like the long way around. Do page anchors trip shouldOverrideUrlLoading? – SoundsDangerous Dec 28 '12 at 04:25
  • i found similar issue with webview..opening such href links. did you find a solution? – visista May 21 '13 at 20:53
  • my page was internal to the device so I had to change the href="#anchor" to href="file:///android_asset/webassets/link.html#anchor". This was the only way to get the anchors to work properly. Hope that helps. – SoundsDangerous May 21 '13 at 23:10

2 Answers2

0

found the answer somewhere ,redirects can be intercepted by shouldOverrideUrlLoading provided u are using API level 11 or greater.

visista
  • 246
  • 4
  • 15
-2

In which version, you are running this program. I found this issue with ICS. In ICS, shouldOverrideUrlLoading() is called, only when I tried to load a wrong URL using Webview. So, you can use this behavior for a quick fix.

chakrapani
  • 1,371
  • 2
  • 9
  • 6