ฉันกำลังพยายามเสนอวิธีให้ผู้ใช้มีแถบด้านบน และด้านล่างจะเป็น IFRAME ซึ่งเต็มไปด้วยเนื้อหาที่เราส่งพวกเขาไป (โดยเราจะส่งพวกเขาไปยังไซต์ถัดไปเมื่อจำเป็น)
ฉันมี:
<div id="top">
some menu options here
</div>
<div id="frame">
<iframe id="newsViewer" src="http://www.bbc.com" frameBorder="0" border="0">Sorry, please enable iFrames to view this</iframe>
</div>
...และ CSS:
#top {
background: rgb(249,249,249);
position: fixed;
height: 90px;
top: 0px;
left: 0px;
width: 100%;
}
#frame {
/*background:red;*/
border-top: 4px dashed #eee;
position: fixed;
top: 90px;
left: 0px;
height: 100px;
width: 100%;
}
https://jsfiddle.net/h2nyLhmu/
สิ่งนี้ทำให้เกิดข้อผิดพลาด CORS แม้ว่า:
โหลดถูกปฏิเสธโดย X-Frame-Options: http://www.bbc.co.uk/ ทำ ไม่อนุญาตให้ทำเฟรมแบบข้ามแหล่งกำเนิด
ฉันเข้าใจว่าทำไมพวกเขาถึงทำมัน แต่มันทำให้โมเดลทั้งหมดของระบบที่ฉันจะใช้แสดงลิงก์เสียหายโดยสิ้นเชิง :/