問題描述有沒有辦法在 中嵌入網站,如果它拒絕嵌入? (Is there any way to embed a website in <IFrame>, If it is denying to be embedded?)</p> <p>我想在 HTML 的 IFrame 標籤中嵌入“www.youtube.com”,但如您所知,它不允許我嵌入它。這個動作有什麼方法或替代方法嗎?</p> <p></p><hr> <h2>參考解法</h2><p><h4>方法 1:</h4> <p>First of all, you have to check for the <code>HTTP</code> response header X‑Frame‑Option of those sites. </p></p> <p>If its value is </p><ul> <li><p>Deny ‑‑> You cannot load the website in IFrame (even if the domain page is the same).</p></li> <li><p>Sameorigin ‑‑> Only a page which is in same domain can load this website in IFrame.</p></li> </ul><p>I don't know how deep you've tried it, but otherwise you can try the following example:</p><p>You can add YouTube videos to your website by using the <code>iframe</code> HTML tags.</p><ol> <li>Use the youtube site to find the video you want</li> <li>Click the 'Share' button below the video</li> <li>Click the 'Embed' button next to the link they show you</li> <li>Copy the iframe code given and paste it into the html of your web page.</li> </ol><p>Although YouTube gives you <code>html code</code> using the iframe tag, you can also include your video using the object tag, its up to you. Here is a small example:</p><pre><code><html> <body> <iframe src="http://www.youtube.com/embed/..." width="500" height="300" frameborder="0" allowfullscreen></iframe> </body> </html> </code></pre><p>(by <a href="https://stackoverflow.com/users/12013153/shafiq‑rana">Shafiq Rana</a>、<a href="https://stackoverflow.com/users/9758017/41‑72‑6c">41 72 6c</a>)</p> <p><h2>參考文件</h2></p> <ol> <li><a href="https://stackoverflow.com/q/57770957">Is there any way to embed a website in <IFrame>, If it is denying to be embedded? (CC BY‑SA 2.5/3.0/4.0)</a></li> </ol>