Skip to content

Instantly share code, notes, and snippets.

@mckelvin
Created October 10, 2012 10:16
Show Gist options
  • Save mckelvin/3864570 to your computer and use it in GitHub Desktop.
Save mckelvin/3864570 to your computer and use it in GitHub Desktop.
a solution for clickhacking
if (top.location !== self.location && document.referrer.search(/http:\/\/[^\/]+\.yourdomain\.com/i) !== 0) {
top.location = self.location;
}
// another to solve this problom is to add `X-Frame-Options` in http response header
// detail: https://blog.whitehatsec.com/x-frame-options/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment