Render different HTML if page is framed ...

OTrap

Elite Member
Joined
Jul 12, 2008
Messages
2,314
Reaction score
1,064
Based on the code, I assume you can see what I'm trying to do. However, I'm pretty new to Javascript, so any help is appreciated.

HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>

<script language="JavaScript">
if ( top.location.href!= window.location.href ) { 

<head>Page 1</head>
<bode>not in a frame</body>

} else {

<head>Page 2</head>
<bode>in a frame</body>

}

</script>

</html>

Thanks.
 
Javascript doesn't mingle with HTML in the same way as PHP.

Do this - put the content you want for case a in a div with id "case1" and the content for the other page inside a div with id "case2". With that javascript if you will make the appropriate div visible and the other hidden.

Obviously this is meaningful if you are trying to display content for users, not for bots.
 
Back
Top