본문 바로가기

기타

html base tag - domain

<base href="http://www.server.com/app-name/path/">  

 

- 보통 <script src="/abc.js"> 처럼 상대경로로 js경로를 입력 하게 된다.

 

사용자가 www.naver.com로 접속을 하면 www.naver.com/abc.js로 인식하게 되는데 base tag를 지정해 놓으면

server.com/abc.js에서 리소스를 가져오게 된다.

 

 

적용 예

---------------------------------------------------------------------------------------------------------------------------

 

<!DOCTYPE html> 
<html class="ui-mobile> 
 <head> 
   <base href="http://www.server.com/app-name/path/">                         
   <meta charset="utf-8"> 
   <title>Page Header</title> 
   <meta content="width=device-width, initial-scale=1" name="viewport"> 
   <link rel="stylesheet" type="text/css" href="jquery.mobile-min.css" /> 
    <script type="text/javascript" src="jquery-min.js"></script> 
    <script type="text/javascript" src="jquery.mobile-min.js"></script> 
 </head> 
 
 <body class="ui-mobile-viewport">                                             
   <div class="ui-page ui-body-c ui-page-active" data-role="page"  
         style="min-height: 320px;"> 
     <div class="ui-bar-a ui-header" data-role="header" role="banner"> 
       <h1 class="ui-title" tabindex="0" role="heading" aria-level="1"> 
           Page Header 
       </h1> 
     </div> 
 
     <div class="ui-content" data-role="content" role="main"> 
         <p>Hello jQuery Mobile!</p> 
     </div> 
 
     <div class="ui-bar-a ui-footer ui-footer-fixed fade ui-fixed-inline"
          data-position="fixed" data-role="footer" role="contentinfo"
          style="top: 508px;"> 
       <h4 class="ui-title" tabindex="0" role="heading" aria-level="1"> 
           Page Footer 
       </h4> 
     </div> 
    </div> 
 
    <div class="ui-loader ui-body-a ui-corner-all" style="top: 334.5px;"> 
      <span class="ui-icon ui-icon-loading spin"></span> 
      <h1>loading</h1> 
    </div> 
 
 </body> 
</html>

[출처] [HTML]<base> tag|작성자 드얼


'기타' 카테고리의 다른 글

[ SPRING ] CXF 를 이용한 WebService 구현 1  (0) 2017.02.27
AngularJS를 소개합니다.  (0) 2016.10.02
중고차 고르기 달인편  (0) 2013.12.01
정규식 표현 특수문자  (0) 2013.07.31
정규식표현 정리  (0) 2013.07.31