Deep Link Solutions

Solution 1: User Choice with Confirmation

// Instead of automatic redirects
<a href="prageru://video/123">Watch Video</a>

// Use JavaScript confirmation
<button onClick={() => {
  if (confirm('Open in PragerU app?')) {
    window.location.href = 'prageru://video/123';
  }
}}>
  Watch Video
</button>
✅ User gets to choose

Solution 2: Smart App Detection

function handleVideoClick(videoId) {
  // Check if user is on mobile
  const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

  if (isMobile) {
    // Show choice modal on mobile
    showAppChoiceModal(videoId);
  } else {
    // Play in browser on desktop
    playInBrowser(videoId);
  }
}

function showAppChoiceModal(videoId) {
  const choice = confirm('You can watch this video in the PragerU app or continue in your browser. Open app?');
  if (choice) {
    window.location.href = `prageru://video/${videoId}`;
  } else {
    playInBrowser(videoId);
  }
}
✅ Different behavior for mobile/desktop

Solution 3: App Download Banner

// Show a banner instead of forcing app opening
<div className="app-banner">
  <p>Get the best experience with our mobile app!</p>
  <button onClick={() => window.location.href = 'prageru://video/123'}>
    Open in App
  </button>
  <button onClick={() => dismissBanner()}>
    Continue in Browser
  </button>
</div>

Get the best experience with our mobile app!

Enhanced video quality and offline viewing

✅ Non-intrusive suggestion

Solution 4: Progressive Enhancement

// Default to browser, enhance with app option
<a href="/video/123" className="video-link">
  Watch Video
</a>

// JavaScript enhancement
document.querySelectorAll('.video-link').forEach(link => {
  link.addEventListener('click', (e) => {
    if (navigator.userAgent.includes('Mobile')) {
      e.preventDefault();
      showAppOption(link.href);
    }
    // Desktop users get normal link behavior
  });
});
Progressive Video Link✅ Works without JavaScript, enhanced with it

Recommended Implementation:

For PragerU, we recommend combining Solutions 2 and 3:

  • Use smart detection to differentiate mobile vs desktop users
  • Show an app banner for mobile users instead of forced redirects
  • Always give users the choice to continue in browser
  • Make the default behavior “stay in browser” unless user explicitly chooses app