jQuery - deeplink for app from browser

0 votes
146 views
added Feb 12, 2020 in jQuery by lcjr First Warrant Officer (9,190 points)
$(AppBanner).click(function () {
  if($('body').hasClass('page-content')) {
      window.location = 'lazacodeorg://story/' + newsId;
  } else {
      setTimeout(function() {
          window.open(AppUrl);
      }, 100);
      window.location = 'lazacodeorg://story/' + newsId;
  }
});

var AppArea = 'body.one-sidebar',
  AppBanner = $('#app-banner'),
  newsUrl = window.location.href,
  newsSplit = newsUrl.split('/'),
  newsId = newsSplit[newsSplit.length-2],
  AppUrl = 'https://www.lazacode.org/appstore'; 

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...