谷歌搜索将无法在新页面中打开

时间:2011-05-17 21:33:08

标签: html search

我希望以下代码能够在新窗口中打开谷歌搜索的结果,但事实并非如此。有没有人有任何建议?

<body>

<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript"> 
  google.load('search', '1', {language : 'en'});
  google.setOnLoadCallback(function() {
    var customSearchControl = new     google.search.CustomSearchControl('001782268784890582031:k30dxi2nexc');
    customSearchControl.setResultSetSize(google.search.Search.SMALL_RESULTSET);
    customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_BLANK);
    customSearchControl.draw('cse');
  }, true);
</script>
<!--<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />-->


</body>

1 个答案:

答案 0 :(得分:2)

不,你误解了google.search.Search.LINK_TARGET_BLANK

的含义

此代码应生成以下搜索结果:与target = _blank的链接。

搜索结果虽然会显示在同一个窗口中。

供参考 - 请参阅: http://code.google.com/apis/websearch/docs/reference.html

相关问题