How to make MOSS 2007 search results open in new window

The tip about opening links in new windows instead of the same window was a great idea but I couldn’t use the same tips since it was for SPS 2003. I wanted to be able to open links in new windows since I noticed a lot of users often times were searching for say PDF’s and then they would accidentally close the browser instead of hitting the back button. Big annoyance for them.
So I was snooping around the Search Core Results Web Part’s XSL Editor to see if I could edit the XSL to open links in new windows instead. It’s actually pretty easy, here are the steps:

1. Go to http://portal/searchcenter/pages/results.aspx

2. Modify Shared Web Part for the Search Core Results WebPart

3. Click on the XSL Editor Button

4. I’d suggest copying the contents of the pop up into notepad/wordpad to do your editing.

5. Search for the following lines:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}”>

______________________________________________

<span class=”srch-Title”>
<a href=”{$url}” id=”{concat(‘CSR_’,$id)}” title=”{$url}”>

____________________________________________________

<xsl:choose>
<xsl:when test=”$IsThisListScope = ‘True’ and contentclass[. = ‘STS_ListItem_PictureLibrary’] and picturethumbnailurl[. != ”]“>
<div style=”padding-top: 2px; padding-bottom: 2px;”>
<a href=”{$url}” id=”{concat(‘CSR_P’,$id)}” title=”{title}”>

__________________________________________

<span class=”srch-URL”>
<a href=”{$url}” id=”{concat(‘CSR_U_’,$id)}” title=”{$url}” dir=”ltr”>

____________________________________________

6. At the ends of each of the <a href= > tags, you’ll want to add on target=”_blank”

For example to make the link attached to the document icon open in a new window, the full tag would be like this:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}” target=”_blank”>

Using the same XSL Editor you can also manipulate how your search results are displayed and even include custom content types if you wanted to!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: