방법 1.
국내의 거의 모든 웹사이트는 자사 사이트 체류 유지를 위해, 모든 외부 링크를 새 창으로 여는 걸 선호합니다. 해당 설정을 SEO 플러그인이나, 개별 버튼 설정 등에서 처리할 수 도 있지만, 간단한 방법으로 일괄 적용할 수 있습니다.
Java Script
document.addEventListener('DOMContentLoaded', function() {
var currentHost = window.location.hostname;
var links = document.querySelectorAll('a');
links.forEach(function(link) {
// 내부 링크가 아니고, 외부 링크(http/https)인 경우만 대상
if (link.hostname && link.hostname !== currentHost && (link.protocol === 'http:' || link.protocol === 'https:')) {
link.setAttribute('target', '_blank');
// 보안을 위한 rel 속성 추가
var currentRel = link.getAttribute('rel') || '';
if (!currentRel.includes('noopener')) {
link.setAttribute('rel', (currentRel + ' noopener noreferrer').trim());
}
}
});
});Code language: JavaScript (javascript)
댓글 1
Truly no matter if someone doesn’t know then its up to oter users tat they will help,
so here itt takmes place. xnxx
Alsoo visit my website – download VPN