i have ios app has 1 view , uiwebview (it opens main content of app). when make click somewhere(e.g on table row) app opens specific link in safari browser not inside uiwebview.
is doable without writing ios code , instead of make javascript opens link in safari ?
i have thatcode,but doesn't @ all:
html code
<tr class='link-to-pdf' data-href='www.example.com'> js code:
$(".link-to-pdf").click(function () { var = document.createelement('a'); a.setattribute("href", this.getattribute("data-href")); a.setattribute("target", "_blank"); var dispatch = document.createevent("htmlevents"); dispatch.initevent("click", true, true); a.dispatchevent(dispatch); });
in cases, can tell links in javascript have target="_blank", , pass them window.open '_system' param. work on both ios , android.
$(document).on('click', 'a[target="_blank"]', function(ev) { var url; ev.preventdefault(); url = $(this).attr('href'); window.open(url, '_system'); }); or in case, replace a.setattribute("target", "_blank"); a.setattribute("target", "_system");
this worked me in ancient projekt, im unsure if still works (on ios , android)
Comments
Post a Comment