2017-02-18 1 views
0

휴대 기기에서 Google ADS를 사용하지 않도록 설정하려고합니다. 분에서자바 스크립트를 사용하는 휴대 기기에서 Google 애드 센스 사용 안 함

나는이

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 
}else 
{ 
<ins class="adsbygoogle" 
    style="display:block" 
    data-ad-client="*****" 
    data-ad-slot="****" 
    data-ad-format="***"></ins> 
} 
<script> 
(adsbygoogle = window.adsbygoogle || []).push({}); 
</script> 

해야하지만 작동하지 않습니다.

휴대 기기에서 Google ADS를 사용 중지하는 코드를 찾기 위해 고심하고 있습니다.

어떤 도움이나 아이디어라도 높이 평가할 수 있습니다.

답변

0

귀하의 코드가 일부 구문 변경 작업을해야

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 
<script> 
isMobile = false; 
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 
isMobile = true; 
} 
if(isMobile){ 
    $(".adsbygoogle").hide(); 
}else{ 
$(".adsbygoogle").show(); 
} 
</script> 

<script> 
(adsbygoogle = window.adsbygoogle || []).push({}); 
</script> 

는 HTML,

<ins class="adsbygoogle" 
     style="display:block" 
     data-ad-client="*****" 
     data-ad-slot="****" 
     data-ad-format="***"></ins> 

그것을 시도 줄이 작동합니다.