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;
}
감사합니다. sir/mam – lucky