Framekiller for Google Image Search

Discussion in 'JavaScript' started by AlexHD, May 21, 2011.

  1. #1
    Hello, mates
    About 50% of all impressions of one my blog are pictures. As you know, when you open a picture via Google Image Search, ads can not be displayed so my CTR is very low. How can I kill this frame?

    I have read here - http://en.wikipedia.org/wiki/Framekiller but can someone explain me better what to do.
    I am using Wordpress.
     
    AlexHD, May 21, 2011 IP
  2. Sefrez

    Sefrez Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would add that code into the header of your pages that you want to kill the iframe. You would set the window location equal to the actual page location. Basically it just checks if it, itself, is the main window. If not, it's considered to be an iframe and redirects to the page you set it to.
     
    Sefrez, May 21, 2011 IP
  3. AlexHD

    AlexHD Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you explain better what to do. How to reach the header for the page where is the picture? And what exactly should be the java script code?
     
    AlexHD, May 22, 2011 IP
  4. AdM.as

    AdM.as Peon

    Messages:
    20
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You would place the frame killer code between the <head> and </head> tags on your page. Below is the frame killer code that Hulu uses, you can verify that it breaks the Google image frame by going to google image search, and typing in 'site:hulu.com' and clicking on any image from hulu.com.

    Simple Frame Killer
    <script type="text/javascript">
    if (top.location != location) {
    	top.location.href = document.location.href;
    }
    </script>
    Code (markup):
    On your actual site it would look like this, notice where the code is placed:

    <html>
    <head>
    <title>Iframe Buster</title>
    
    <script type="text/javascript">
    if (top.location != location) {
    	top.location.href = document.location.href;
    }
    </script>
    </head>
    <body>
    
    <p>This is the body of your page.</p>
    
    </body>
    </html>
    HTML:
    Enjoy :)
     
    AdM.as, May 23, 2011 IP