Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Improved protection against cross framing
We now include CSS to hide the page and display it conditionally after checking we're in top frame. This adds extra protection for clients who do not support X-Frame-Options. See also http://en.wikipedia.org/wiki/Framekiller and https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet
- Loading branch information
Showing
2 changed files
with
6 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,9 @@ | ||
| /* vim: set expandtab sw=4 ts=4 sts=4: */ | ||
| /** | ||
| * Conditionally included if third-party framing is not allowed | ||
| * | ||
| * Conditionally included if framing is not allowed | ||
| */ | ||
|
|
||
| try { | ||
| if (top != self) { | ||
| top.location.href = self.location.href; | ||
| } | ||
| } catch(e) { | ||
| alert("Redirecting... (error: " + e); | ||
| top.location.href = self.location.href; | ||
| if(self == top) { | ||
| document.documentElement.style.display = 'block' ; | ||
| } else { | ||
| top.location = self.location ; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters