Google CSE is a free service. Just open a Google account, go to the CSE page, create a CSE and select its look and feel and features. Get the code, paste it in your website and you’re done! It is as simple as that. However, if you want to fine-tune your search engine –you may need to do a bit of research. One of the common question that people have is “how do I change the link target of search results thrown up by Google?” The default link target of Google CSE is “_blank” but many webmasters want links to open in the same window (or, although rarely, in an iframe or frameset). Here we present the solution to this problem. The code for CSE you get from Google has three parts:
A JavaScript code Markup for place where search box is to be rendered Markup for place where search results are to be shown
To change the target of links, you would need to make a small change in the last item. You get the following markup from Google: gcse:searchresults</gcse:searchresults> And you need to add the linkTarget attribute to this markup. For example: <gcse:searchresults linkTarget=”_parent”></gcse:searchresults> Value of this attribute can be anything that is acceptable as a link target (i.e. top, blank, parent, self or a frame’s name). The above example will open the search result links in the same window. Which linktarget is more suitable for you all depends on your need and design of you website or blog. Thankfully Google has provided us the facility to decide linktarget on our own. I hope this small tip saved you some time and solved your problem. Please let me know if you have any questions about this topic. Thank you for using TechWelkin.