我想在 iframe 和选项卡上使用 facebook 页面和 gmail 以及此类社交媒体页面。我该怎么做?
有些页面可以加载,有些页面如facebook和gmail不能。
这是我的尝试
<!DOCTYPE html>
<head>
<title>Test page</title>
</head>
<body>
<h1>iframes</h1>
<iframe src="http://www.facebook.com"></iframe>
<iframe src="http://www.gmail.com"></iframe>
<iframe src="http://www.w3schools.com"></iframe>
<br>
<h1>divs</h1>
<div>
<object type="text/html" data="http://www.facebook.com" width="300px" height="300px" style="overflow:auto;float:left;border:5px ridge blue">
</object>
</div>
<div>
<object type="text/html" data="http://www.w3schools.com" width="300px" height="300px" style="overflow:auto;border:5px ridge blue">
</object>
</div>
</body>
</html>
最佳答案
这是不可能的,HTTP 响应中的 X-Frame-Options - 禁止它。
但是如果你在服务器上做一个简单的代理 - 它将通过 file_get_contents 加载它们并提供 - 来自你网站的节目 - 转向
关于javascript - 如何在 iframe 和 div 上获取 facebook、gmail 网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39935006/