jeudi 5 février 2015

Disabling 'onClick' in FireFox 35


I've added a video to my site using the default html5 video player. The code is like this.



<video width="100%" height="100%" controls>
<source src="http://ift.tt/16vTSab" type="video/mp4">
</video>


I wanted to make it so a click on the video stops or starts the video. So I added this:



onclick="this.paused?this.play():this.pause();"


And all good. Until Firefox 35 adds this very function to the player. So now you can only play the video by right clicking and selecting play. Terrible. So I thought up a javascript function something like this:



function startstop() {
if ( FirefoxVersionNumber > 34 ) {
do nothing
} else {
start or stop video
}
}


The bit I'm stuck on is how to check the browser version? All the ones I tried returned that Firefox version number was 5... which I think comes from the Netscape part.





Aucun commentaire:

Enregistrer un commentaire