一些必须知道的前端新特性
作者:互联网
*****html5新特性
1、HTML5播放器,支持的视频格式有:MP4
、WebM
、OGG;支持的音频格式:
mp3
、wav
、ogg
2、全屏API
//W3C建议 HTMLElement.requestFullscreen() //Chrome、safari、Opera浏览器 HTMLElement.webkitRequestFullScreen() //Firefox HTMLElement.mozRequestFullScreen() //Internet Explorer/Edge HTMLElement.msRequestFullscreen()
兼容浏览器写法
function enterFullscreen(element){ if(element.requestFullscreen){ element.requestFullscreen() } else if(element.webkitRequestFullScreen){ element.webkitRequestFullScreen() } else if(element.mozRequestFullScreen){ element.mozRequestFullScreen(); } else if(element.msRequestFullscreen){ element.msRequestFullscreen(); } }
退出全屏模式
function exitFullscreen(){ if(document.exitFullscreen){ document.exitFullscreen(); } else if(document.webkitExitFullScreen){ document.webkitExitFullScreen(); } else if(document.mozCancelFullScreen){ document.mozCancelFullScreen(); } else if(document.msExitFullscreen){ document.msExitFullscreen(); } }
摘自:https://blog.csdn.net/csdn_smartyang/article/details/108200834
3、canvas、svg
4、draggable="true" | DragEvent
5、DataTransfer`对象
当页面中不存在<input type="file">
时,可通过DataTransfer
对象的files
属性来获取被拖放的文件对象,其返回FileList
的对象
6、FormData 对象
标签:HTMLElement,前端,msRequestFullscreen,特性,else,exitFullscreen,必须,element,document 来源: https://www.cnblogs.com/Zhang-jin/p/14148862.html