[英]Load html page in iframe
今天,我發現了一種非常奇怪的代碼結構方法(對我而言)。 網站頁面使用iframe進行自我調用。 我的問題是:值得嗎? 可能是因為安全問題? 提前謝謝大家
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Azerbaijan Technical University</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<style>
html, head, body, iframe{
width:100%;
height:100%;
margin:0;
padding:0;
border:none;
overflow:hidden;
}
</style>
</head>
<body>
<iframe id="frm" name="frmn" src="/" onload="location.hash = this.contentWindow.location.href.replace(this.contentWindow.location.origin,'');"></iframe>
<script type="text/javascript">
if (location.hash && location.hash != '') {
document.getElementById('frm').src = location.origin + location.hash.replace("#","");
}
else {
document.getElementById('frm').src = "main.do"; //"/login";//
}
</script>
</body >
</html >
如今,不建議使用iframe,即使Facebook和google也不允許您將其網站放置在iframe中。 您使站點容易受到跨站點攻擊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.