Wednesday, 15 June 2011

html5 - How to add an attribute by detecting web or mobile devices in html tag -


I have a video tag in my website

  & lt; Video id = "html_video" style = "width: 100%;" Silent autoplay id = "bgvid" & gt; & Lt; Source src = "video / newvideo.mp4" type = "video / mp34" & gt; & Lt; / Video & gt;  

Its work is fine without having to control the web but in the ipad safari autoplay is not known then I play in the safari ipad Added control attribute to show the button.

The code gets

   

Now the control is available for the ios and the web, clicking on the playback button, the video runs in the iPad.

My question is, is it possible to add this control attribute to Safari iPad and website only, it does not have a percentage of feature?

appreciate any type of answer

thanks in advance

  $ (document) .ready (function () {if navigator.)  

UserAgent.match (/ iPhone / i) navigator.userAgent .match (/ ipad / i) navigator.userAgent.match (/ ipod / i)) {document.getElementById ('html_video') Set attribute ("control", "1");} and {document.getElementById ('Html_video'). Remove Remove ("Control", "1");}});

Thanks.


No comments:

Post a Comment