Google CSE let’s you host a custom Google search on your own website or application for users to search and see results from Google for your site or a specified set of sites. Google CSE stands for Custom Search Engine.

The custom search engine by Google works great, I love it. It indexes your specified sites and displays very accurate, relevant results.

Using Google’s custom search engine can boost page views on your site

The only part that bothered me was that the links in the search results opened in a new tab/window and there isn’t any setting to change how it behaves. You can, however achieve this with code.

So your Google CSE results code may look like this:

You want to change the results wrapper and add a linktarget="_parent" attribute and value to it which will tell Google CSE to open results in the same tab/window.

So change the last line:

To this:

And that’s it, problem solved, your Google custom search engine results will now open in the same window/tab accordingly.

Shares