2013-02-26 3 views
4

:jQuery 모바일 스크립트에서 기본 태그를 제거하려면 어떻게해야합니까? jQuery를 모바일

  • 어떻게
  • 가 어떻게 기본 href를 사용하지 않는 페이지에서 <base href=""> 태그를 제거하는 방법은 무엇입니까?

관련 코드 :

// Test for dynamic-updating base tag support (allows us to avoid href,src attr rewriting) 
function baseTagTest() { 
    var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", 
     base = $("head base"), 
     fauxEle = null, 
     href = "", 
     link, rebase; 

    if (!base.length) { 
     base = fauxEle = $("<base>", { "href": fauxBase }).appendTo("head"); 
    } else { 
     href = base.attr("href"); 
    } 

    link = $("<a href='testurl' />").prependTo(fakeBody); 
    rebase = link[0].href; 
    base[0].href = href || location.pathname; 

    if (fauxEle) { 
     fauxEle.remove(); 
    } 
    return rebase.indexOf(fauxBase) === 0; 
} 

답변

0

기본 요소가 jQuery를 모바일 사이트 동적 기본 요소를 업데이트 할 수 없습니다 브라우저에서로드 할 때, 그 앞에 추가 너무 많이 jQuery를 모바일의 탐색 모델에 핵심 요소이며, 베이스 URL.

두 제안은 당신의 필요를 해결하기 :

  1. 사용 절대 파일 경로 대신 상대는

  2. jQuery Mobile Download Builder를 사용하여 당신은 당신의 jQuery를 모바일 응용 프로그램에 필요한 모듈을 사용자 정의 할 수 있습니다. 내 초기 추측은 기본 요소 기능을 제거하기 위해 탐색 모듈을 제외하려는 것입니다.

+0

감사합니다. sir/mam – lucky

관련 문제