Changing Links List In SharePoint 2007 To Open In New Browser Window

I was recently looking for the easiest way to modify the links list in SharePoint 2007 to open the links in a new window.  In my case, every link in a links list points to an external site, so they should all be opening a new browser window.
 
There were a couple custom features I found, but most required modifying (or replacing) the existing links lists, something that I did not want to do.  Anyway, here's how to make the change (note:  I modified the original files, this probably isn't a best practice, and the changes could be lost by updates from Microsoft).
 
First, open the schema file for the links list feature.  In my case, it was located at:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LinksList\Links\schema.xml
In this file there should be two instances of the following:
 
<Column Name="URL" HTMLEncode="TRUE" /><HTML><![CDATA[">]]></HTML>
 
Replace them both with this:
 
<Column Name="URL" HTMLEncode="TRUE" /><HTML><![CDATA[" target="_blank">]]></HTML>

Then restart IIS (or just the application's worker process), and now all the links in your links lists should open a new browser window!

Published Friday, March 07, 2008 2:29 PM by marker126
Filed under: ,

Comments

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Saturday, March 08, 2008 8:32 AM by joeaudette

Hi,

Please forgive my little rant.

-- begin rant

The notion that links even to external sites "should open in a new window" is not the view of the w3c or the accessibility community.

The user should always be in control therefore you really shouldn't open links in new windows. The problem is through historical bad practices some users seem to expect this. I think we need to educate our users about the basics of using web browsers. Every major browser allows the user to open in a new window or tab by right clicking the link. The user should be empowered to control when new windows open for themselves and the expected behavior should be that clicking a link does not open a new window.

-- end rant :-)

With your example, the page will not be valid XHTML because the target attribute was deprecated. However for those who really want to open windows there is a way to do it and still pass the w3c xhtml validator. Instead of putting the target in as you have it, this would do the same result and pass the validator:

onclick="window.open(this.href,'_blank');return false;"

Still, my 2 cents is its better not to open new windows just because its an external link.

Cheers,

Joe

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Saturday, March 08, 2008 11:05 AM by marker126

Hey Joe, thanks for your input!

I agree with you 100%.  Funny that you should say something, because when my manager originally requested this feature, my response was "can't the user just hold down SHIFT?"  But, when it comes down to it I don't have the final say, such is life.

I like your suggestion for setting the onclick event handler, I'll have to try it out.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Friday, March 21, 2008 10:42 AM by Shadowlo

Will this affect all out of the box links lists? What if you just want this to affect an individual links list?

--S

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Tuesday, April 01, 2008 9:53 AM by marker126

S:

This will affect all OOTB link lists.  To affect an individual links list you'll need to create a custom feature.  Good luck!

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, June 25, 2008 8:58 AM by Steven

Hi Joe,

So what would be the full syntax of the new code?

Thanks!

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, July 30, 2008 6:53 PM by bhddscene

as one poster said cant the user hold down the shift key. that would be too easy and egos would not be fed.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Friday, August 08, 2008 10:05 AM by JMB

I agree with the "shift" and "right click" options however I agree with the author as well....I am maintaining Intranet sites for my company and the end users aren't exactly all computer savy so I am forced to come up with a way have a new window open as well due to requests by my management.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, August 13, 2008 12:10 PM by Jim Azeltine

I feel that there should be a checkbox on the properties page for links to indicate that the page should open in a new window. I consider this to be a missing feature.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Monday, January 12, 2009 1:13 PM by Max

I think making changes to xml files is a bad idea (not only for the fact that these can change when reinstalling/upgrading, but such changes are usually not documented). Sometimes, you can't make the decision, but I do believe you can train the users to use right-click the link and open in a new tab/window. Since SharePoint is used as intranets, training should be fairly easy. Also, after a few times, the users will know not to left-click the link.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Monday, January 19, 2009 9:42 AM by Anas

i applied your action then the same issue (the same window) i reset IIS

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Tuesday, February 03, 2009 5:20 PM by Chris

Yes, my users are not savy AT ALL.  Asking them to Shift Click or Right Click is asking too much.  Thanks for the help though...

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Friday, February 13, 2009 8:25 AM by Bryan

Sorry, but I disagree entirely with Joe's rant.  External links should ALWAYS open in a new window.  Otherwise the user has to resort to the browser's back button to get back to the site, which is very very messy. In my opinion, opening images, pdfs or external web pages in the same window is ridiculous.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, March 04, 2009 8:46 PM by Susan

Totally agree with Bryan. I have several external links. My users aren't savy either. In the end, the customer must get what they want.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Thursday, April 09, 2009 2:52 PM by Salim Vasani

Excellent tip. It might not meet all the best practices, but well this is an intranet and I am going to do it the way I want. Worked like a charm. Thanks.

# Open SharePoint Link List Item in new window &laquo; Ani&#8217;s Web Diary

Pingback from  Open SharePoint Link List Item in new window &laquo;  Ani&#8217;s Web Diary

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Tuesday, May 05, 2009 2:00 PM by José Couto

Thanks a lot!!!!!!!!!!

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, May 06, 2009 12:30 PM by Matt

I have an NO CODE OPTION...I haven't fully tested this in all areas but it's working for me so far.

In the Issue Tracking list there's a column type called "Hyperlink with formatting and constraints for publishing".  This column type allows you to define whether the link will open in the site or "in new window".

1.  Create a new List using Issue Tracking.

2.  Create a column using type "Hyperlink with formatting and constraints...."

3.  Remove all the other columns (Title and Category can't be removed)

4.  Change the Title column..in Default value put an "x" or something else.

5.  Create a View showing only the Link column.

Now you can add a webpart anywhere on your site using this list and View.

I'm using SP2008 with MOSS 3...I'm sure that makes a difference.

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Wednesday, May 13, 2009 12:45 PM by Chris

Thanks for this information - this did the trick!

# re: Changing Links List In SharePoint 2007 To Open In New Browser Window

Thursday, June 25, 2009 10:53 AM by James

I totally agree with the author too.  If you don't open an external link in a new window it is difficult to 'unwind' their way back to the orignal site - especially if they have clicked several links on the external site.  Usability suffers and in this case telling the users that you followed some standard will fall on deaf ears.  If the standard is as Joe explained, it should be changed.

# Link library &#8211; ?????????????? ???????? ?? ?????????? ???????? - Sharepoint &#8211; ?????????????????? ??????????

Pingback from  Link library &#8211; ?????????????? ???????? ?? ?????????? ???????? - Sharepoint  &#8211; ?????????????????? ??????????

# SharePoint 2007 - Opening Links in a New Window

Wednesday, October 14, 2009 9:38 AM by Julian Stevens

SharePoint 2007 - Opening Links in a New Window

Leave a Comment

(required) 
(required) 
(optional)
(required)