remove one instance of inline js
This commit is contained in:
20
js/cross_framing_protection.js
Normal file
20
js/cross_framing_protection.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Conditionally called from libraries/header_scripts.inc.php
|
||||
* if third-party framing is not allowed
|
||||
*
|
||||
*/
|
||||
|
||||
try {
|
||||
// can't access this if on a different domain
|
||||
var topdomain = top.document.domain;
|
||||
// double-check just for sure
|
||||
if (topdomain != self.document.domain) {
|
||||
alert("Redirecting...");
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
alert("Redirecting... (error: " + e);
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
@@ -18,23 +18,7 @@ require_once './libraries/common.inc.php';
|
||||
// Cross-framing protection
|
||||
if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
try {
|
||||
// can't access this if on a different domain
|
||||
var topdomain = top.document.domain;
|
||||
// double-check just for sure
|
||||
if (topdomain != self.document.domain) {
|
||||
alert("Redirecting...");
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
alert("Redirecting... (error: " + e);
|
||||
top.location.replace(self.document.URL.substring(0, self.document.URL.lastIndexOf("/")+1));
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<script src="./js/cross_framing_protection.js" type="text/javascript"></script>
|
||||
<?php
|
||||
}
|
||||
// generate title
|
||||
|
Reference in New Issue
Block a user