将HTML框架src设置为google.com;不工作 [英] Setting HTML Frame src to google.com; not working
本文介绍了将HTML框架src设置为google.com;不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下php代码:
<?php
require_once(support.php) ;
$ query = $ _POST [search];
$ google =http://www.google.com/search?q=。 $查询;
$ bing =http://www.bing.com/search?q=。 $查询;
$ yahoo =http://search.yahoo.com/search?p=。 $查询;
$ ask =http://www.ask.com/web?q=。 $查询;
$ body =< html>< head>;
$ body。=< script src = \scripts.js\>< / script>;
$ body。=< / head>;
$ body。=< frameset rows = \50%,50%\cols = \50%,50%\>;
$ body。=< frame src = \$ google\/>;
$ body。=< frame src = \$ bing \/>;
$ body。=< frame src = \$ yahoo\/>;
$ body。=< frame src = \$ ask \/>;
$ body。=< / frameset>;
$ body。=< / html>;
echo $ body;
?>
产生以下html:
< HTML>
< head>
< script src =scripts.js>< / script>
< / head>
< frameset rows =50%,50%cols =50%,50%>
< frame src =http://www.google.com/search?q=adf/>
< frame src =http://www.bing.com/search?q=adf/>
< frame src =http://search.yahoo.com/search?p=adf/>
< frame src =http://www.ask.com/web?q=adf/>
< / frameset>
< / html>
当我在谷歌浏览器中打开这个页面时,我从上面的url 。但在第一帧中,谁的src来自谷歌,我什么也没得到;只是一个空白的框架。
任何想法在这里发生了什么?
谢谢
Google设置了 X-Frame-Options
标题添加到 SAMEORIGIN
,它禁止非Google.com网站嵌入其页面。大多数现代浏览器都尊重这一设置。
i have the following php code:
<?php
require_once("support.php");
$query = $_POST["search"];
$google = "http://www.google.com/search?q=" . $query;
$bing = "http://www.bing.com/search?q=" . $query;
$yahoo ="http://search.yahoo.com/search?p=" . $query;
$ask = "http://www.ask.com/web?q=" . $query;
$body= "<html><head>";
$body .= "<script src=\"scripts.js\"></script>";
$body .= "</head>";
$body .= "<frameset rows=\"50%,50%\" cols=\"50%,50%\" >";
$body .= "<frame src=\"$google\" />";
$body .= "<frame src=\"$bing\" />";
$body .= "<frame src=\"$yahoo\" />";
$body .= "<frame src=\"$ask\" />";
$body .= "</frameset>";
$body .= "</html>";
echo $body;
?>
which produces the following html:
<html>
<head>
<script src="scripts.js"></script>
</head>
<frameset rows="50%,50%" cols="50%,50%" >
<frame src="http://www.google.com/search?q=adf" />
<frame src="http://www.bing.com/search?q=adf" />
<frame src="http://search.yahoo.com/search?p=adf" />
<frame src="http://www.ask.com/web?q=adf" />
</frameset>
</html>
when i open this in google chrome, i get 4 frames with the expected content, from the above url's. but in the first frame, who's src is from google, i get nothing; just a blank frame. any idea what is going on here?
Thanks
解决方案
Google sets their X-Frame-Options
header to SAMEORIGIN
, which forbids non-Google.com sites from embedding their pages. Most modern browsers respect this setting.
这篇关于将HTML框架src设置为google.com;不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文