¾È±Ô °øºÎ¹æ

Javascript & JQuery & CSS > Modernizr.js ¶óÀ̺귯¸®¸¦ ÀÌ¿ëÇÑ HTML5 API Áö¿øÀ¯¹« È®ÀÎ

µî·ÏÀÏ : 2017-07-04 19:39 Á¶È¸¼ö : 53,615

1. HTML5ÀÇ ±â´É Áö¿ø À¯¹« È®ÀÎ

ÃÖ±Ù¿¡´Â HTML5 API¸¦ ÀÌ¿ëÇÏ¿© À¥ ÇÁ·Î±×·¥À» ¸¸µå´Â »ç¿ëÀ²ÀÌ Á¡Á¡ ´õ ³ô¾ÆÁ®°¡°í ÀÖ´Â °Í °°½À´Ï´Ù.

±×·±µ¥ HTML5¸¦ ÀÌ¿ëÇÏ·Á°í ÇÒ ¶§¸¶´Ù Ç×»ó ¹ß¸ñÀ» Àâ´Â °ÍÀÌ ÀÖ½À´Ï´Ù. ±×°ÍÀº ¹Ù·Î HTML5 API¸¦ ¸ðµç ºê¶ó¿ìÀú¿¡¼­ Áö¿øÇÏÁö ¾Ê´Â´Ù´Â Á¡ÀÔ´Ï´Ù.

ºê¶ó¿ìÀú°¡ °ú°Å ¹öÀüÀÏ °æ¿ìµµ ¹®Á¦Áö¸¸ ÃֽŠ¹öÀüÀÏ °æ¿ì¶ó ÇÏ´õ¶óµµ ÀϺΠAPI¸¦ Áö¿øÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù.

±× ¶§¹®¿¡ HTML5ÀÇ ±â´ÉÀ» ÀÌ¿ëÇÏ·Á¸é Ç×»ó Á¶°Ç °Ë»ç¸¦ ÅëÇؼ­ Áö¿ø À¯¹«¸¦ È®ÀÎÇؾ߸¸ ÇÕ´Ï´Ù.

Àü¿¡ ÀÛ¼ºÇß´ø canvas °ü·Ã ±Û¿¡¼­µµ ¾ð±ÞÇß´ø °Íó·³  Canvas¸¦ Áö¿øÇÏ´ÂÁö¸¦ ¾Ë¾Æº¸·Á¸é ´ÙÀ½°ú °°Àº Äڵ带 ÀÛ¼ºÇؾ߸¸ Çß½À´Ï´Ù.


var canvas = document.getElementById("canvas");
if(canvas.getContext == undefined)
alert("Canvas¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.");

ÀÌ·± °í¹ÎÀº ¸ðµç À¥ °³¹ßÀڵ鿡°Ô µ¿ÀÏÇÑ °í¹Î°Å¸®°¡ ¾Æ´Ò ¼ö ¾ø½À´Ï´Ù.


¸¸¾à¿¡ ÀÌ·¸°Ô ºê¶ó¿ìÀú°¡ HTML5 API¸¦ Áö¿øÇÏ´ÂÁö¸¦ ½±°Ô È®ÀÎÇÏ°íÀÚ ÇÑ´Ù¸é ±×·± ºÎºÐ¿¡ µµ¿òÀ» ÁÙ ¼ö ÀÖ´Â ¿ÀǼҽº

¶óÀ̺귯¸® Modernizr¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ¶óÀ̺귯¸®´Â http://modernizr.com/ ¿¡¼­ Á¦°ø´Â ¶óÀ̺귯¸®ÀÔ´Ï´Ù.


2. Modernizr ¶óÀ̺귯¸®¶õ?

¶óÀ̺귯¸®´Â HTML5¿Í CSS3ÀÇ ±â´ÉÀ» È°¿ëÇÒ ¼ö ÀÖ´ÂÁö¸¦ ¾Ë¾Æº¸´Â ´Ù¾çÇÑ ±â´ÉµéÀ» Á¦°øÇÏ°í ÀÖ½À´Ï´Ù.

ÇÏÁö¸¸ ½ÇÁ¦·Î modernizr´Â ´Ü¼øÈ÷ À¯¹«¸¸ È®ÀÎÇÏ´Â ±â´ÉÀ» ³Ñ¾î¼­¼­ °ú°Å ¹öÀüÀÇ ºê¶ó¿ìÀú¿¡ HTML5¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï

ÇÏ´Â polyfills ±â´Éµµ Á¦°øÇÕ´Ï´Ù. ±×·¯ÇÑ ±â´É¿¡ ´ëÇؼ­´Â ´ÙÀ½ ºí·Î±×¸¦ ÅëÇؼ­ Çϳª¾¿ ¾Ë¾Æº¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.

(¿©±â¼­ polyfills¶õ °ú°Å¹öÀüÀÇ ºê¶ó¿ìÀú¿¡ »õ·Î¿î ºê¶ó¿ìÀú°¡ °¡Áö´Â ±â´ÉÀ» Áö¿øÇϱâ À§ÇÑ Ç÷¯±×ÀÎÀ» ÀǹÌÇÏ´Â ¿ë¾îÀÔ´Ï´Ù.)

3. Modernizr ¶óÀ̺귯¸®¸¦ ÀÌ¿ëÇÏ´Â ÃÊ°£´Ü ÇÑ ¿¹Á¦

´Ù¿î¹ÞÀº ¶óÀ̺귯¸®°¡ ½ºÅ©¸³Æ®¸¦ ÀÛ¼ºÇÏ´Â ¹®¼­¿Í µ¿ÀÏÇÑ Æú´õ¿¡ ÀÖ´Ù°í °¡Á¤ÇÏ¸é ´ÙÀ½°ú °°ÀÌ ¶óÀ̺귯¸®¸¦ ¹®¼­¿¡ Æ÷ÇÔ½Ãŵ´Ï´Ù.


<script src="modernizr.js"> </script>

À§¿Í °°ÀÌ modernizr ¶óÀ̺귯¸®¸¦ Æ÷ÇÔ½ÃÄ×´Ù¸é canvas ¸¦ Áö¿øÇÏ´ÂÁö¸¦ ¾Ë¾Æº¸±â À§ÇÑ Á¶°Ç¹®Àº ´ÙÀ½Ã³·³ °£´ÜÇØ Áý´Ï´Ù.


if(!Modernizr.canvas)
alert("Canvas¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.");

Á¤¸» °£´ÜÇÏ°Ô ±¸ÇöÇÒ ¼ö ÀÖÀ½À» ¾Ë ¼ö ÀÖ½À´Ï´Ù. ÇÏÁö¸¸ ´Ü¼øÀÌ ÀÌ·± Á¤µµ¶ó¸é ±»ÀÌ ÀÌ ¶óÀ̺귯¸®¸¦ »ç¿ëÇÒ Çʿ伺ÀÌ °­·ÄÇÏ°Ô

´Ù°¡¿ÀÁö´Â ¾ÊÀ» °Í °°½À´Ï´Ù. ¾Õ¿¡¼­µµ Àá±ñ ¾ð±ÞÇß´ø °Íó·³ ÀÌ·¸°Ô Áö¿ø À¯¹«¸¦ ¾Ë·ÁÁÖ´Â °Í ¿Ü¿¡µµ Modernizr´Â ´õ ¸¹Àº ±â´Éµéµµ Á¦°øÇÏ°í ÀÖ½À´Ï´Ù.


4. HTML5, CSS3 »õ¿ä¼Ò Áö¿ø¿©ºÎ °Ë»ç
 
		if(Modernizr.canvas) document.getElementById("canvas").innerHTML = "O";  
		if(Modernizr.draganddrop) document.getElementById("draganddrop").innerHTML = "O";  
		if(Modernizr.crosswindowmessaging) document.getElementById("crosswindowmessaging").innerHTML = "O";  

		if(Modernizr.localstorage) document.getElementById("localstorage").innerHTML = "O";
		if(Modernizr.sessionstorage) document.getElementById("sessionstorage").innerHTML = "O";
		if(Modernizr.websqldatabase) document.getElementById("websqldatabase").innerHTML = "O";
		if(Modernizr.indexeddb) document.getElementById("indexeddb").innerHTML = "O";
		if(Modernizr.applicationcache) document.getElementById("applicationcache").innerHTML = "O";

		if(Modernizr.geolocation) document.getElementById("geolocation").innerHTML = "O";  
		if(Modernizr.webworkers) document.getElementById("webworkers").innerHTML = "O";
		if(Modernizr.websockets) document.getElementById("websockets").innerHTML = "O";

		if(Modernizr.audio) document.getElementById("audio").innerHTML = "O";
		if(Modernizr.video) document.getElementById("video").innerHTML = "O";

		if(Modernizr.cssanimations) document.getElementById("cssanimations").innerHTML = "O";
		if(Modernizr.csstransforms) document.getElementById("csstransforms").innerHTML = "O";
		if(Modernizr.csstransforms3d) document.getElementById("csstransforms3d").innerHTML = "O";
		if(Modernizr.svg) document.getElementById("svg").innerHTML = "O";  

 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.