Stop some one not to use my site in IFram

Discussion in 'PHP' started by zahidraf, Mar 1, 2010.

  1. #1
    any way to stop that no body can use my site in iframe
     
    zahidraf, Mar 1, 2010 IP
  2. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #2
    You could try to access referer data $_SERVER['HTTP_REFERER']; and block if it isn´t your dns..

    Not all clients sends this though...
     
    n3r0x, Mar 1, 2010 IP
  3. zahidraf

    zahidraf Well-Known Member

    Messages:
    450
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    I can get the refer but how DNS ?
     
    zahidraf, Mar 1, 2010 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    Try this:

    Place this at the top of your page:

    
    <script language=" JavaScript" >
    <!-- 
    function LoadOnce() 
    { 
    window.location.reload(); 
    } 
    //-->
    </script>
    Code (markup):
    Then change your <Body> to say;

    <Body onLoad=" LoadOnce()" >
    Code (markup):
     
    Last edited: Mar 1, 2010
    MyVodaFone, Mar 1, 2010 IP
  5. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Send the header X-FRAME-OPTIONS: DENY
     
    krsix, Mar 1, 2010 IP
  6. HostingProvider

    HostingProvider Active Member

    Messages:
    1,480
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    95
    #6
    Put this anywhere between your <head> & </head> tags:
    <script language="JavaScript">if(top !=self)top.location=self.location;</script>
    HTML:
    And you're done. Now when your visitors are visiting your site in an iframe, your site will break out of frames and redirect the whole browser to your page.
     
    HostingProvider, Mar 1, 2010 IP