Quantcast
Channel: Blog: Posts
Viewing all articles
Browse latest Browse all 64

Open links in a new window in Sharepoint Online lists / libraries

$
0
0
Body:

If you want your links in an SP list to open up in a new window, you can change the behavior with this simple update to the list view's xsl code. All that's needed is to add "target="_blank" to the line in the xsl that creates the link. I'm using a "links" list here but this works for any list with links in it.

Assuming you already have a list added to a page, open that page in Sharepoint Designer 2010 in advanced mode. Select SPLIT view.

  • The links in the list will display in the "design" view at bottom.
  • Click a link and you'll see the corresponding bit of xsl highlighted in the code portion of your screen.
  • It will look like this:


    <a onfocus="OnLink(this)" href="{$url}" >

  • Add target="_blank"  so it looks like this:

    <a onfocus="OnLink(this)" href="{$url}" target="_blank" >

Since the xsl loops through your list, every link will get updated when the page is rendered in a browser. So save the page and test it out.

NOTE: if you're not able to find the line referenced above and don't see 1700+ lines of code for the web part, try this:

Click the top of web part in design  view where it says "webpartpages:xsltlistviewebpart"

In the ribbon click design under list view tools

Click customize xslt and then select "entire view".

Then try to locate the code for the links in the list

Published: 9/5/2012 11:43 AM
# Comments:

Viewing all articles
Browse latest Browse all 64

Trending Articles