1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

[SHARE] Google Web Preview! cuman buang-buang bandwidth, ini dia jamunya

Discussion in 'Wordpress' started by r4tn4, Feb 21, 2012.

  1. r4tn4

    r4tn4 Super Hero

    Joined:
    Mar 31, 2006
    Messages:
    3,828
    Likes Received:
    2,668
    Location:
    https://www.tikie.online
    Google Web Preview adalah fitur yang disediakan oleh search engine google, dengan adanya fitur ini visitor akan bisa melakukan preview terlebih dahulu sebelum mereka memutuskan untuk mengunjungi sebuah website.
    Tapi sisi yang tidak enaknya adalah buat para pemilik web, dengan konsumsi bandwidth dan resource cpu yang sama, visitor yang berpotensi mengantarkan recehan dollar buat kita akan lewat begitu saja, iseng-iseng saya googling, ternyata banyak juga orang-orang yang mengeluh dengan Google Web Preview.
    Terinspirasi dari situ maka saya coba bikin kode sederhana untuk memblokir visitor yang menggunakan Google Web Preview.

    PHP:

    <?php
    /*
    Plugin Name: Google Web Preview Blocker
    Plugin URI: http://www.agcextreem.com
    Description: Stop wasting bandwidth!
    Author: Ratna Dewi
    Version: 0.1
    */
    add_action('wp_head''google_web_preview_blocker');

    function 
    google_web_preview_blocker()
    {
        
    $ua strpos($_SERVER['HTTP_USER_AGENT'],'Google Web Preview');
        if(
    $ua !== false)
        {
            
    ?>
    <!---Silakan edit pesan dibawah ini untuk memberitahukan calon visitor untuk tidak menggunakan google web preview--->
    <h1>You are using Google Web Preview</h1>
    <h1>Please visit our site directly, to see the content</h1>
    <!------>        
            <?php
            
    exit;
        }
        
    }
    ?>
    Simpan kode diatas dalam sebuah file php, kemudian upload di direktori, domain.com/wp-content/plugins
    lalu aktifkan dari dashboard wp admin.

    **jangan lupa untuk memberikan cap jempol (tekan tombol like, disebelah kiri bawah) kalo sekiranya bermanfaat buat anda

    penampakan setelah plugin di aktifkan

    [​IMG]
    View attachment 16667


    Untuk blogspot user, bisa pake versi javascriptnya seperti di bawah ini, silakan taro di bagian header
    HTML:
    <script type="text/javascript">
    
    function strpos (haystack, needle, offset) {
        var i = (haystack + '').indexOf(needle, (offset || 0));
        return i === -1 ? false : i;
    }
    
    var ua = navigator.userAgent;
    var find = strpos(ua,"Google Web Preview")
    if(find !== false)
    {
        setTimeout(hideBody,1);
    }
    
    function hideBody()
    {
      document.body.innerHTML = "<br /><div align='center'><div style='font-size:36px;font-weight:bold;color:red;font-family:tahoma'>You are Using <u>Google Web Preview</u><br/>Unfortunately we do not support it, please visit our site directly<br/><br/>Thank You</div></div>";
    }
    </script>
    
    Snipet untuk blogspot, di tempel di template,... kode dibawah siap pake, sedangkan yang diatas belum di konversi

    HTML:
    &lt;script type=&quot;text/javascript&quot;&gt; 
    
    function strpos (haystack, needle, offset) { 
        var i = (haystack + '').indexOf(needle, (offset || 0)); 
        return i === -1 ? false : i; 
    } 
    
    var ua = navigator.userAgent; 
    var find = strpos(ua,&quot;Google Web Preview&quot;) 
    if(find !== false) 
    { 
        setTimeout(hideBody,1); 
    } 
    
    function hideBody() 
    { 
      document.body.innerHTML = &quot;&lt;br /&gt;&lt;div align='center'&gt;&lt;div style='font-size:36px;font-weight:bold;color:red;font-family:tahoma'&gt;You are Using &lt;u&gt;Google Web Preview&lt;/u&gt;&lt;br/&gt;Unfortunately we do not support it, please visit our site directly&lt;br/&gt;&lt;br/&gt;Thank You&lt;/div&gt;&lt;/div&gt;&quot;; 
    } 
    
     
    Last edited: Feb 28, 2012
  2. andiguritno

    andiguritno Guest

    Pertamax dulu mastah :)
     
  3. srodoks

    srodoks Super Hero

    Joined:
    Dec 6, 2010
    Messages:
    1,565
    Likes Received:
    180
    Like meluncur mastah,,, emang kadang2 nyebelin jg klu spt itu... hufhhh, mgkn ini jd salah satu solusinya..
     
  4. Bloggermacz

    Bloggermacz Super Hero

    Joined:
    Jul 27, 2011
    Messages:
    796
    Likes Received:
    269
    Location:
    Makassar
    Asyk dapat jamu baru..:)) Like meluncur..
     
  5. AbHafd

    AbHafd Ads.id Pro

    Joined:
    Jul 22, 2010
    Messages:
    360
    Likes Received:
    5
    Location:
    Pekanbaru
    Makasih mbak Ratna.... Like penceted deh :D
     
  6. pahlawan_bertopeng

    pahlawan_bertopeng Ads.id Pro

    Joined:
    Jan 19, 2011
    Messages:
    372
    Likes Received:
    2
    mntap mbk suhu :D :D
     
  7. masrimanas

    masrimanas Super Hero

    Joined:
    Oct 18, 2010
    Messages:
    1,612
    Likes Received:
    106
    Location:
    Kampar, Riau
    keren euy,
    like penceted:D
     
  8. LatifahM

    LatifahM Banned

    Joined:
    Feb 8, 2010
    Messages:
    483
    Likes Received:
    15
    sip, meskipun ane kaga ngarti, tapi sepertinya layak dicoba, apalgi menyangkut recehan dollar :D
     
    Ahmads likes this.
  9. lerry

    lerry SuperMi

    Joined:
    Oct 21, 2009
    Messages:
    3,500
    Likes Received:
    528
    Coba dulu mbak yu.....
     
  10. menilajah

    menilajah Super Hero

    Joined:
    Mar 29, 2011
    Messages:
    3,390
    Likes Received:
    582
    Location:
    BE 64 UL BandarLampung-ID
    Pagi2 disuruh minum jamu, biar sehat :D
    Like nya dipencet mastah
     
  11. aditwebid

    aditwebid Super Hero

    Joined:
    Mar 10, 2011
    Messages:
    1,877
    Likes Received:
    32
    Location:
    Dumai - Medan - Brastagi
    jadi ntar di serp, hasilnya gak ada previewnya mba?
     
  12. r4tn4

    r4tn4 Super Hero

    Joined:
    Mar 31, 2006
    Messages:
    3,828
    Likes Received:
    2,668
    Location:
    https://www.tikie.online
    previewnya tetep ada, tapi yang muncul ada pesan kita,... nah silakan edit pesan yang akan muncul pada saat seseorang membuka web kita lewat Google Web Preview

    contoh:

    Emangnya bandwidth gak bayar coy


    :peace:
     
    tuyul, jackysan, aditwebid and 2 others like this.
  13. iisbetoq

    iisbetoq Super Hero

    Joined:
    Jul 13, 2011
    Messages:
    2,713
    Likes Received:
    233
    Location:
    Mobile Proxy Indonesia
    ikutan minum jamu sapa tau jadi sehat :D
     
  14. ceudah

    ceudah Super Hero

    Joined:
    Feb 26, 2010
    Messages:
    1,158
    Likes Received:
    88
    Location:
    Nanggroe Aceh Darussalam
    previewnya di kasi image cpa offer :D
     
  15. bintang_kecil

    bintang_kecil Super Hero

    Joined:
    Jun 3, 2010
    Messages:
    1,266
    Likes Received:
    56
    Versi inggrisnya apa ya mbak?
     
  16. iisbetoq

    iisbetoq Super Hero

    Joined:
    Jul 13, 2011
    Messages:
    2,713
    Likes Received:
    233
    Location:
    Mobile Proxy Indonesia
    plugin nya konflik mbak ama Easy Contact plugin mbak
    deactive trus di active in lagi masih konflik, harus di deactive permanent plugin Easy Contact nya
     
  17. r4tn4

    r4tn4 Super Hero

    Joined:
    Mar 31, 2006
    Messages:
    3,828
    Likes Received:
    2,668
    Location:
    https://www.tikie.online
    Mungkin gini kali ya.... CMIIW
    Please understand, I paid a lot for bandwidth

    ** rada sopan dikit :D


    ini dia contoh penampakan
    [​IMG]

    ---------- Post added at 12:14 AM ---------- Previous post was at 12:12 AM ----------

    kayaknya sama2 bekerja di wilayah header :)
    kalo gak mau konflik langsung tancepin aja aja kode php nya di file header (themes), atau kalo mau bener2 menghemat resource CPU tempelnya di file index.php (root blog)

    PHP:
    $ua = strpos($_SERVER['HTTP_USER_AGENT'], 'Google Web Preview');
    if ($ua !== false) {
    ?>
    <!---Please put your message here, make sure it has big size font--->
    <h1>You are using Google Web Preview</h1>
    <h1>Please visit our site directly, to see the content</h1>
    <!------>        
            <?php
        
    exit;
    }
     
    iisbetoq likes this.
  18. iisbetoq

    iisbetoq Super Hero

    Joined:
    Jul 13, 2011
    Messages:
    2,713
    Likes Received:
    233
    Location:
    Mobile Proxy Indonesia
    untuk di file header ga bisa, konflik ama theme nya :D kebetulan pake theme flexibility, jadi di pasang di index.php nya, problem solved :D
     
  19. r4tn4

    r4tn4 Super Hero

    Joined:
    Mar 31, 2006
    Messages:
    3,828
    Likes Received:
    2,668
    Location:
    https://www.tikie.online
    selamat deh kalo begitu,.... semoga bisa berguna juga buat yang lainya,.. yang mengalami masalah seperti anda :)
     
  20. panda23

    panda23 Ads.id Fan

    Joined:
    Sep 15, 2011
    Messages:
    183
    Likes Received:
    4
    Location:
    joglosemar
    mantab ... ternyata bisa di akali juga, tapi itu ga bikin bahaya blog kita kan? thanks sharenya :D
     

Share This Page