setAttribute and video.src for changing video tag source not working in IE9

前端 未结 1 1369
予麋鹿
予麋鹿 2020-11-28 08:08

I have literally read every stackoverflow thread regarding changing the video tag source dynamically via javascript in IE9, including the useful but not agreed upon posts he

1条回答
  •  旧巷少年郎
    2020-11-28 08:28

    Great news, I found a true solution to switching/changing videos in HTML5 video tags via JavaScript without using the annoying hack I tried to explain! It's unbelievably simple and it just took a LOT of experimenting with IE. Below is the code in its simplest form to work in IE:

    
      
        
    
    
    
        
      
    
    

    And there you have it. Unbelievably simple -- tested and working in IE8, and IE9... If you are having any problems, please let me know.

    0 讨论(0)
提交回复
热议问题