Created
September 23, 2014 09:30
-
-
Save stamm/f68f903cfb23ab63f2d1 to your computer and use it in GitHub Desktop.
Disable show page in frame
This file contains hidden or 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
if (top != self) { | |
var enable = ["example.com","dev.example.com"]; | |
var ourPage = false; | |
var hostname = document.referrer.split("/")[2].split(":")[0]; | |
for (var i=0; i < enable.length; i++) { | |
if (hostname == enable[i] || hostname == "www." + enable[i]) { | |
ourPage = true; | |
break; | |
} | |
} | |
if ( ! ourPage) { | |
window.top.location = window.location.href; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment