< script type="text/javascript" > var myvideos = document.querySelectorAll('.myvideo video'); if ( navigator.userAgent.match( /(iPod|iPhone|iPad)/ ) ) { for (let index = 0; index < myvideos.length; index++) { myvideos[index].setAttribute('playsinline', ''); } }