Edit HTML File
Filename
HTML Content
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Deeplink Tester (Advanced with Intent)</title> <style> body { font-family: Arial, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; background-color: #f7f7f7; padding: 20px; text-align: center; } h1 { margin-bottom: 20px; } input { width: 300px; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; } button { width: 200px; padding: 10px; margin: 5px; border: none; border-radius: 4px; background-color: #007bff; color: white; font-size: 16px; cursor: pointer; } button:hover { background-color: #0056b3; } .notice { margin-top: 20px; color: #555; } </style> </head> <body> <h1>Deeplink Tester (with Intent)</h1> <input type="text" id="deeplink" placeholder="Enter deeplink URL (e.g., paypay://)"> <input type="text" id="packageName" placeholder="Enter package name (optional, e.g., jp.ne.paypay.android.app)"> <div> <button onclick="openDeeplink('android')">Open in Android</button> <button onclick="openDeeplink('ios')">Open in iOS</button> </div> <div class="notice" id="notice"></div> <script> function openDeeplink(platform) { const link = document.getElementById('deeplink').value.trim(); const packageName = document.getElementById('packageName').value.trim(); const notice = document.getElementById('notice'); if (!link && !packageName) { alert('Please enter at least a deeplink URL or package name'); return; } notice.innerText = 'Attempting to open the app...'; let fallbackUrl = ''; if (platform === 'android') { fallbackUrl = 'https://play.google.com/store'; } else if (platform === 'ios') { fallbackUrl = 'https://apps.apple.com/'; } const start = Date.now(); if (platform === 'android') { if (link && packageName) { const deeplinkHost = link.replace('://', '/'); const intentUrl = `intent://${deeplinkHost}#Intent;scheme=${link.split('://')[0]};package=${packageName};end;`; window.location.href = intentUrl; } else if (packageName && !link) { const intentUrl = `intent://#Intent;package=${packageName};end;`; window.location.href = intentUrl; } else { window.location.href = link; } } else { if (link) { window.location.href = link; } else { window.location.href = fallbackUrl; } } setTimeout(function() { const end = Date.now(); if (end - start < 3000) { window.location.href = fallbackUrl; } }, 2000); } // Autofill from query params window.addEventListener('DOMContentLoaded', () => { const urlParams = new URLSearchParams(window.location.search); const deeplinkParam = urlParams.get('deeplink'); const packageParam = urlParams.get('package'); if (deeplinkParam) { document.getElementById('deeplink').value = decodeURIComponent(deeplinkParam); } if (packageParam) { document.getElementById('packageName').value = decodeURIComponent(packageParam); } }); </script> </body> </html>
Save HTML File
Cancel