javascript - How open link in safari mobile app from webview -


there many topics of here, need native code interaction work.

in case, necessary able directly url, without interaction mobile app.

i tried:

<a href="safari://google.com" target="_blank">open google in safari</a>

and

<a href="webkit://google.com" target="_blank">open</a>

and based in this post.

<script>     $(document).on('click', 'a[target="_blank"]', function (ev) {       var url;        ev.preventdefault();       url = $(this).attr('href');       window.open(url, '_system');     });   </script> 

but nothing works.

anyone have idea how fix this?

if running in safari should comply safari async call restrictions regarding popups explained here.

you should fix code window open outside function, that:

    <script>     var windowreference = window.open();      $(document).on('click', 'a[target="_blank"]', function (ev) {       var url;        ev.preventdefault();       url = $(this).attr('href');       windowreference.location = url;     });   </script> 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -