서버 점검 안내

dsclub은 서비스의 안정성과 성능 향상을 위해
매일 04시 30분에 정기 점검이 진행됩니다.

점검 시간: 오전 4시 30분 ~ 4시 35분

해당 시간 동안 일시적으로 서비스에 접속이 불가능하오니, 양해 부탁드립니다.

구글 애드센스 특정 페이지에서 작동 안하게 수정 > 코딩 스토리

구글 애드센스 특정 페이지에서 작동 안하게 수정

페이지 정보

작성자 profile_image tak2 (192.♡.0.1) 작성일 24-09-09 03:35 조회 280 댓글 0

본문

<script>
const blockedPaths = ['/bbs/profile.php', '/bbs/follow.php', '/bbs/memo.php']; // 구글 애드센스 차단할 페이지 경로
if (blockedPaths.includes(window.location.pathname) && window.location.pathname !== '/index.php') { //이 코드 자체가 작동을 멈출 경로
   const adsenseScripts = document.querySelectorAll('script[src*="pagead2.googlesyndication.com"]');
   adsenseScripts.forEach(script => script.parentNode.removeChild(script));
}
</script>


*사용 결과 이 코드가 작동을 멈츌 경로를 설정해두지 않으면, 이 코드가 있는 페이지의 최신글 출력 부분이 프로필 url, 프로필 이미지url과 게시글 연결 url이 http로 바뀌는 오류 발생함

좋아요0 이 글을 좋아요하셨습니다
url 복사 카카오톡 공유 라인 공유 페이스북 공유 트위터 공유

등록된 댓글이 없습니다.

전체 269건
게시물 검색

접속자집계

오늘
465
어제
1,445
최대
4,271
전체
291,375