1

HTML

<a class="intent" href="http://mymobilewebsite"  data-scheme="myApp://"></a> 

Javascript

(function () {

            goToUri($("a.intent").data('scheme'), $("a.intent").attr('href'));
            event.preventDefault();

            function goToUri(uri, href) {
                var start, end, elapsed;

                start = new Date().getTime();
                document.location = uri;

                end = new Date().getTime();

                elapsed = (end - start);

                if (elapsed < 1) {
                    document.location = href;
                }
            }               
        })();

This code is based on Chase's answer at Here

However the code is sometimes working sometimes not and could not figure out why?

Community
  • 1
  • 1
Mehmet Eren Yener
  • 2,006
  • 1
  • 23
  • 37

0 Answers0