Userful Javascripts
From Zedomax Wiki
Break out of iFrames
<script type="text/javascript">
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
</script>
How to prevent users from leaving the page
<script type="text/javascript">
window.onbeforeunload = confirmExit;
function confirmExit(){
return "The page you are attempting to view is trying to break out of the frame it is in.";
}
</script>
Automatic Window Resize
<script type="text/javascript">
function resizeiframe() {
var height = document.documentElement.clientHeight;
height -= document.getElementById('frame').offsetTop;
height -= 115;
document.getElementById('frame').style.height = height +"px";
};
document.getElementById('frame').onload = resizeiframe;
window.onresize = resizeiframe;
</script>