Google custom search open in same window

Google custom search open in same window

Rate this article

Share this article

Read Remove URLs in Google custom search for more information.

Opening links in the same tab as the results is not the default behavior of Google Custom Search. This is also not desirable in most cases but luckily there are two simple ways to fix this and force links to open in the same window/tab as the search results.

Google custom search open in same window

Build a fully customizable Search without any coding

Force Google Custom Search to open links in the same window/tab – method 1

I have used Google Custom Search on a number of my websites and it worked really well. Unfortunately for some reason, Google decided that links on the rendered search results would open in a new window/tab by default i.e. they have their target set to _blank. The first way to force Google custom search to open links in the same tab is by modifying your CSE code, specifically the gcse element.

Add a linktarget attribute and set it to “_parent”. This will force any links from search results to open in the same window/tab as the search results themselves.

<gcse:searchresults-only linktarget="_parent"></gcse:searchresults-only>
Force Google Custom Search to open links in the same window/tab – method 2

The second and perhaps easier option is to make the change right in the CSE console. In the Search features section under the Advanced tab enter _parent to the Link Target option, then click Save.

Force Google Custom Search to open links in the same window/tab – bonus method

If you are finding it increasingly difficult to customize things on GCS, then I recommend switching to an alternate solution that will give the customization you are looking for in a matter of a few clicks.

Build a fully customizable Search without any coding

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like