¹®¼ ÁÖ¼ÒÀÇ Á¦ÀÏ ¾Õ¿¡ ³ª¿À´Â ÄÝ·Ð(:)±îÁöÀÇ ¼Û½Å ¹æ½ÄÀ» ³ªÅ¸³»´Â ¹®ÀÚ¿ Á¤º¸¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
¿¬°á °³Ã¼ÀÇ À̸§ÀÌ´Ù.
ÀÌ ¼Ó¼ºÀº Àбâ/¾²±âÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.
protocol ¼Ó¼ºÀº ¹®¼ÀÇ ¼Û½Å¹æ¹ýÀ» ³ªÅ¸³»´Â ¹®ÀÚ¿·Î ¹®¼ÀÇ Á¦ÀÏ Ã³À½ ºÎºÐÀ¸·Î ÄÝ·Ð(:)±îÁö¸¦ Æ÷ÇÔÇϸç,
http:, ftp;, mailto:µîÀ¸·Î ¾Æ·¡¿Í °°´Ù.
| URL type | Protocol | ¿¹Á¦ |
|---|---|---|
| Navigator info | about: | about:cache |
| File | file:/ | file:///javascript/methods.html |
| FTP | ftp: | ftp://ftp.mine.com/home/mine |
| Gopher | gopher: | gopher.myhost.com |
| World Wide Web | http: | http://home.netscape.com/ |
| JavaScript code | javascript: | javascript:history.go(-1) |
| MailTo | mailto: | mailto:info@netscape.com |
| Usenet | news: | news://news.scruznet.com/comp.lang.javascript |
| Navigator source viewer | view-source: | view-source:wysiwyg://0/file:/c|/temp/genhtml.html |
protocol ¼Ó¼ºÀº Á¤º¸¸¦ È£½ºÆ®¿¡¼ »ç¿ëÀÚ¿¡°Ô ¾î¶»°Ô ¼Û½ÅÇϴ°¡¸¦ Á¤ÀÇÇÑ´Ù.
http¿Í ftp protocolÀÌ °¡Àå ¸¹ÀÌ »ç¿ëµÇ°í ºê¶ó¿ìÀú´Â ´Ù¸¥ ¹Ì¸® Á¤ÀÇµÈ ÇÁ·ÎÅäÄݵéÀ» Áö¿øÇÑ´Ù.
document, img¿Í location °³Ã¼¿¡¼´Â protocol ¼Ó¼ºÀÌ ÀбâÀü¿ëÀÌ´Ù.
location.protocol ¼Ó¼ºÀº ÁÖ¼ÒÀÇ ¾ÕÂÊ ¹®ÀÚ¿À» ù¹øÂ° ÄÝ·Ð(:)±îÁö¸¦ Æ÷ÇÔÇÏ¿© ¹ÝȯÇÑ´Ù.(¿¹: http:).
¹Ý¸é document.protocolÀº ÇÁ·ÎÅäÄÝ ¾à¾î¸¦ ¹ÝȯÇÑ´Ù.(¿¹: Hypertext Transfer ProtocolÀ» http·Î)
protocol ¼Ó¼ºÀº ¾ðÁ¦³ª ¼³Á¤ÀÌ °¡´ÉÇÏÁö¸¸, href ¼Ó¼ºÀ¸·Î ¿¬°áÀ» »õ·Î ¼³Á¤ÇÏ¿© »ç¿ëÇÏ´Â °ÍÀÌ ¾ÈÀüÇÏ´Ù.
| °³Ã¼ | script | HTML | ±Ô°Ý | IE |
|---|
<A href="http://trio.co.kr/cgi/bbs/triobbs.cgi?db=triobbs">trio °Ô½ÃÆÇ</A><BR> <SCRIPT> for (i=0;i<document.links.length;i++){ if(document.links[i].hostname=='trio.co.kr') document.write(document.links[i].href+'<BR><FONT color=blue>'+document.links[i].protocol+'</FONT><BR>'); } </SCRIPT>
<SCRIPT>
document.write('document.location.protocol=<FONT color=blue>'+document.location.protocol+'</FONT><BR>');
document.write('location.protocol=<FONT color=blue>'+location.protocol+'</FONT><BR>');
document.write('document.protocol=<FONT color=blue>'+document.protocol+'</FONT><BR>');
</SCRIPT>
<SCRIPT>
function allProtocol(){
allLinks=document.links;
str='allLinks.length='+allLinks.length+'<BR>';
for (i=0;i<ALLLINKS.length;i++){
if (!allLinks[i].protocol) return;
str+='allLinks['+i+'].protocol='+allLinks[i].protocol+'<BR>';
}
showA.innerHTML=str;
}
</SCRIPT>
<BUTTON onclick=allProtocol()>ÆäÀÌÁöÀÇ ÇÁ·ÎÅäÄÝ ¸ðµÎ º¸±â</BUTTON>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>