Looking for a solution to disable autoplay for animated gifs on my chat-site (php-based). Tried script below but out of ideas:
<script>
myVid=document.getElementsByTagName('img');
function disableAutoplay()
{
myVid.autoplay=false;
myVid.load();
}
</script>
</head>
<body onload="disableAutoplay();">
Goal: Stop GIFs from auto-playing on load. Thanks
Update
Made it work with jquery, but looking for cleaner solution-> Thinking about using mouseover-events, any suggestions?
$com = $_POST['txt'];
$count = strlen($com);
$com = stripslashes($com);
$alter1 = array(".gif");
$com = str_ireplace($alter1, ".gif autoplay=false onmouseover **MAKE IT PLAY**", $com);
Not sure if controlling GIFs like this with HTML-tags is possible.