Dynamically change embedded video src in IE/Chrome (works in Firefox)

后端 未结 2 1675
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 08:33

I\'m trying to dynamically change an embedded video on a page. It\'s working in Firefox but for some reason it\'s not working in IE and Chrome (strange combination). Here\'s

2条回答
  •  忘掉有多难
    2021-01-12 09:17

    Finally figured out something that works in IE, Firefox, and Chrome.

    It seems a little unusual to do it this way but it works in IE8/Firefox/Chrome so it sounds good to me.

    $("#video a").click(
                function() {
                    var videoAddress = $(this).attr("href");
    
                    $("#media-active").html(" ");
                    $("#media-active").html('' +
            '' +
            '');
    
                    return false; // stop the default link so it just reloads in the video player
                }
    );
    

提交回复
热议问题