// 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>
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); } }
// 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
// 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 }); });
For PragerU, we recommend combining Solutions 2 and 3: