[HTML] URL 사용 규칙

권장되지 않음 — 정규화된 사이트 내 URL을 사용하지 않는 것이 좋습니다.

<h1>Welcome To Example.com</h1>
<script src="http://example.com/jquery.js"></script>
<link rel="stylesheet" href="http://assets.example.com/style.css"/>
<img src="http://img.example.com/logo.png"/>;
<p>Read this nice <a href="http://example.com/2014/12/24/">new
post on cats!
</a></p>
<p>Check out this <a href="http://foo.com/">other cool
site.
</a></p> 

즉, 사이트 내 URL을 가급적 프로토콜에 상대적으로(프로토콜 배제, //example.com으로 시작) 또는 호스트에 상대적으로(/jquery.js와 같이 경로만으로 시작) 만들어야 합니다.

권장 — 프로토콜에 상대적인 사이트 내 URL을 사용하는 것이 좋습니다.

<h1>Welcome To Example.com</h1>
<script src="//example.com/jquery.js"></script>
<link rel="stylesheet" href="//assets.example.com/style.css"/>
<img src="//img.example.com/logo.png"/>;
<p>Read this nice <a href="//example.com/2014/12/24/">new
post on cats!
</a></p>
<p>Check out this <a href="http://foo.com/">other cool
site.
</a></p> 

권장 — 상대적인 사이트 내 URL을 사용하는 것이 좋습니다.

<h1>Welcome To Example.com</h1>
<script src="/jquery.js"></script>
<link rel="stylesheet" href="//assets.example.com/style.css"/>
<img src="//img.example.com/logo.png"/>;
<p>Read this nice <a href="/2014/12/24/">new
post on cats!
</a></p>
<p>Check out this <a href="http://foo.com/">other cool
site.
</a></p>
0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기
captcha
자동등록방지 숫자입력

웹개발

번호 제목 글쓴이 날짜 조회수
2 HTML 특수문자 리스트 최고관리자 08-08 1,414
1 유니코드 특수문자 리스트 최고관리자 08-08 1,461