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

后端 未结 3 1201
一生所求
一生所求 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:53

    Javascript:

     document.getElementById('video-id').addEventListener('ended',function(){
         window.location.href = 'http://www.your-url.com';
     },false);
    

    jQuery:

      $("#video-id").on("ended", function() {
           window.location.href = 'http://www.your-url.com';
        });
    

    Youtube:

    How to detect when a youtube video finishes playing?

提交回复
热议问题