skip to main content

TAMU Webmaster's Blog


Information and insight from the A&M Webmasters

Opening Google Custom Search results in the same tab

May 9th, 2014 by mdmcginnis

Our Google Custom Search results were opening a new tab every time we clicked on a result. I don’t remember that happening before; maybe Google changed something while I wasn’t looking.

One of our colleagues from the Division of Research alerted us about this problem, and we agreed it was indeed a problem. Our web links should be opening new windows only in very special cases, and a search result isn’t one of them. Few want to fill their desktop with dozens of tiny tabs or windows.

Fortunately, changing the search behavior was a simple fix. On our search results page, we simply replaced
<gcse:searchresults-only></gcse:searchresults-only>
with
<gcse:searchresults-only linktarget="_parent"></gcse:searchresults-only>

Now by default, each Google Custom Search result will open in the same tab. To get back to the list of results, just click the Back button. If you really want the result to open in a new tab, right-click on the link and choose “Open in new tab.”  Or “Open in new window.”

I’ve updated the code on our search engine page, so to add an A&M search engine to your website, just grab it and go.  Creating your own department or college custom search engine isn’t hard either. Contact us if you need any tips.

Friday, May 9th, 2014 Search
Share this article

No comments yet.

Leave a comment

Categories

Archives