views:

167

answers:

2

Am using Custom Google search in my web page

Code:

<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('016457557644291857915:ivjbplcmt5k');
    customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
    customSearchControl.draw('cse');
  }, true);
</script>

The above code is working properly, but it is showing the search result in that page itself. I want to display a search result page in a separate page.

Need Code Help

A: 

How about with the option Iframe in Looks and Feels Tab?

Iframe. Provides limited customization and requires a separate page for results on your site.

S.Mark
+2  A: 

You can use a special method from Custom Search API, just add this line after setResultSetSize() and before draw() method:

customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_BLANK)

And links will open in a new window.

I hope that should work as you want.

mlen