ios - Trap Anchor HREFs in Ionic Framework -
i have html coming in database ionic app, when clicks predefined link in html takes on fullscreen window of app , there no way app force quitting it. how can trap these navigation events without needing parse html , add directives each time load in html?
edit include sample code:
p.item-body(ng-bind-html="item.body")
item.body
contains <a>
tags. want prevent these <a>
tags navigating away app in root web view.
i don't intend use block navigation.. need trap anchors open them in $cordovainappbrowser instead of in uiwebview app hosted in.
i recommend against because it's bad ux, here's how can it:
function preventnavigation() { var allanchors = document.getelementsbytagname('a'); function prevdefault(evt) { evt.preventdefault(); } for(var = 0; < allanchors.length; i++) { allanchors[i].onclick = prevdefault; } }
Comments
Post a Comment