javascript - 自定义 Google 搜索 Ajax 调用

标签 javascript asp.net google-custom-search

我正在使用自定义 Google 搜索来获取搜索查询的 Google 内容。

它在我的开发人员工具中显示了一些错误。该错误不影响结果意味着结果显示在我的 UI 中,但显示了一些错误。

错误是

  1. 加载“http://www.google.com/cse?q=web%20storage%20in%20html5&client=google-coop&h”时遇到无效的“X-Frame-Options” header …330&dt=1364365747827&u_w=1366&u_h=768&bs=1366,333&ps=1366,0&frm=0#master-1': 'ALLOWALL' 不是公认的指令。 header 将被忽略。

  2. 不安全的 JavaScript 试图从 URL 为 about:blank 的框架访问框架 URL 为 http://www.google.com/cse?q=web%20storage%20in%20html5&client=google-coop&h …330&dt=1364365747827&u_w=1366&u_h=768&bs=1366,333&ps=1366,0&frm=0#master-1。域、协议(protocol)和端口必须匹配。

  3. 加载“http://www.google.com/cse?q=web%20storage%20in%20html5&client=google-coop&h”时遇到无效的“X-Frame-Options” header …earch.aspx%3Fquery%3Dweb%2520storage%2520in%2520html5%26type%3D2#slave-1-1':'ALLOWALL' 不是公认的指令。 header 将被忽略。

这三个错误显示在我的 Developer 工具中。

我在aspx页面的代码

<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script>
    google.load('search', '1');
    // get a custom search control & keep it in cseControl
    // note: put your own custom search ID number here
    var cseControl = new google.search.CustomSearchControl('009827885688477640989:igzwimalyta');
    // open pages from search results clicks on the same page
    cseControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
    // when there are no matches, explain why
    cseControl.setNoResultsString("Sorry, there are no pages in this web site that match all the search terms.");
    // make the search field visible in div with ID 'cseDiv'
    cseControl.draw('divGoogleResult');

    cseControl.execute(userInput);
</script>

为什么会出现这个错误?如何消除这些错误?

最佳答案

why this error is showing?

  1. 因为 Google 的代码做了一些非标准的事情
  2. 因为 Google 的代码会尝试做不允许的事情。
  3. 这与1相同

how to remove these errors?

除非不使用 Google 的代码(或在 Google 找到一份从事该服务的工作!),否则您不能。

关于javascript - 自定义 Google 搜索 Ajax 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15653151/

相关文章:

c# - 文本框值将显示其他文本框信息,无需单击按钮

c# - 使用 Microsoft Jet OLEDB 对 CSV 的列限制

php - 如何将 Google 自定义搜索集成到我的网站中?

css - Google 自定义搜索框文本溢出一行

google-custom-search - 使用 Google 自定义搜索 API 进行日期范围搜索

javascript - jQuery.each() - 将额外的参数传递给回调参数

Javascript 回调函数未执行

asp.net - CSS 表格 - 右侧不适合浏览器

javascript - 谷歌分析 - 一个页面上有多个跟踪器(cookie 冲突)

javascript - 如何在刷新jsp页面单击单选按钮后保持单选按钮处于选中状态