Copy the code code as follows:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test</title>
<script language="javascript" type="text/javascript">
function getStyle() {
if (window.top == window.self) {
document.getElementById("top").style.display = 'block';
} else {
document.getElementById("top").style.display = 'none';
}
}
</script>
</head>
<body onload="getStyle();">
<form id="form1" runat="server">
<div id="top">
Not displayed in the frame, displayed during normal access
</div>
</form>
</body>
</html>
Display div top when the current page is accessed normally
The page does not display the div top when the current page is in an iframe