javascriptdomain-masking

How to prevent our site from visitor access via domain masking or url masking


Example real site http://stackoverflow.com/

URL Masking http://masking.com/stackoverflow

Question

How to switch the URL masking http://masking.com/stackoverflow to original URL http://stackoverflow.com/

Let me know how can be done in PHP or JavaScript


Solution

  • Masking site urls are done with frames. All you need to do is add a frame-breaking script.

    Just add this in your header:

    <script type="text/javascript">
    if (parent.frames.length > 0) {
    parent.location.href = self.document.location
    }
    </script>