function isOldIOSDevice() { const userAgent = navigator.userAgent || navigator.vendor || window.opera; // Check if it's an iOS device const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream; if (!isIOS) return false; // Extract iOS version from userAgent const match = userAgent.match(/OS (\d+)_/); if (match && match.length > 1) { const majorVersion = parseInt(match[1], 10); // Example: Consider iOS 12 and below as old return majorVersion <= 12; } // If version not found, assume not old return false; } if (isOldIOSDevice()) { document.addEventListener('DOMContentLoaded', function() { setTimeout(() => { document.querySelectorAll('audio:not(.plyr audio)').forEach(function(audio, index) { audio.setAttribute('controls', '') }); }, 3000); }); } // ios old devices