How can I redirect to a URL after a HTML video has ended?

后端 未结 3 1209
一生所求
一生所求 2020-12-10 00:01

I am trying to redirect to a different URL after a html video has ended. This cannot be using a FLASH player as it won\'t work on iOS devices. Any help or direction will be

3条回答
  •  没有蜡笔的小新
    2020-12-10 00:49

    set the id of your video to 'myvid' and here is the solution

    video = document.getElementById('myvid');
    video.addEventListener('ended',function() {alert('video is ended');       
    window.location.href = 'http://www.google.com';})
    

    here is the demo

提交回复
热议问题