2

My android app has a webview, All links are opened on chrome when being clicked. However, when a link is created dynamically, somehow it opens inside webview. I am adding href url dynamically using;

Html

<a id="downloadpic" href="">Click</a>

jQuery

var myurl = "http://www.example.org";
$("#downloadpic").attr("href",myurl);

Which way should I follow to make it open on browser ?

user198989
  • 4,574
  • 19
  • 66
  • 95
  • 1
    You could try adding `target="_blank"` which is usually how it is done in the browser – Mikkel Sep 02 '17 at 09:08
  • Same problem happens. – user198989 Sep 02 '17 at 09:16
  • 1
    Maybe you need to update the target dynamically too? – Mikkel Sep 02 '17 at 09:19
  • Have a look at this answer, there appears to be an option to declare a handler and then return false or true to govern how the link is opened https://stackoverflow.com/questions/9986788/android-webview-click-open-within-webview-not-a-default-browser – Mikkel Sep 02 '17 at 09:22
  • Hi Mikkel, yes I am already using shouldOverrideUrlLoading() on my app. But It doesnt work on dynamically added ones. Maybe its a bug. – user198989 Sep 02 '17 at 09:29

0 Answers0