How to open hyperlinks in a new window (or not)

When dealing with hyperlinks in SharePoint, users often point out the two following limitations:
– in a links list, there is no option to open a link in a new window.
– When using calculated columns to build URLs, the result is not displayed in a user-friendly way.

There are various methods to work around these limitations. Today I am going to show mine, which has the advantage of only using the SharePoint UI (no need for SharePoint Designer).

The issue

To understand the issue, let’s build a list of links pointing to the Microsoft SharePoint newsgroups:

First, we create a custom list (Site Settings > Create > Custom list), call it “Microsoft newsgroups”, and add these four items:

The second step is to create a calculated column to build the links to the newsgroups:
Name: “URL”
Type: Calculated column

= CONCATENATE ("", [Title])

Let’s take a look at the result:

As expected, we have been able to build our URL, and the browser has interpreted it as a hyperlink. But the display is not very user-friendly. We’d prefer to just see the titles, for example “sharepoint.general”.

Building an user-friendly list of links

To achieve this result, I am going to apply to the above list my method: using calculated columns to write HTML.

This is the HTML I need (Title displayed, and on click open URL):
<DIV><a href=”URL”>Title</a></DIV>

So in SharePoint I am going to change the [URL] formula to this:

=CONCATENATE("<DIV><a href='","",Title,"'>",Title,"</a></DIV>")

Now, the final touch: add the script to convert the string to HTML (how?), and you should now see this:

What is still missing is the option to open the link in a new window. Here are the steps:
– create an additional column in your list:
Name: “Open in new window?”
Type: Yes/No (check box)
– change the formula in the URL to this:

=CONCATENATE("<DIV><a href='","",Title,IF([Open in new window?]=TRUE,"' target='_blank' ","'"),">",Title,"</a></DIV>")

Here is the final formula in clear (but you should actually copy/paste the above one):
=CONCATENATE(“<DIV><a href='”,””,Title,IF([Open in new window?]=TRUE,”‘ target=’_blank’ “,”‘”),”>”,Title,”</a></DIV>”)

As usual, feedback is welcome!

87 thoughts on “How to open hyperlinks in a new window (or not)

  1. Pingback: How to create links, labels and coloring in a SharePoint list : End User SharePoint

  2. Does this work in WSS? I cannot copy your link as you indicate but I copied the text that is displayed. I get an error message, just wondering if it is ok with WSS?

  3. Yes, this works in WSS.

    Due to the page formatting, the end of the formulas is hidden. You should still be able to select the whole formula with a triple click.
    If you use the formula in clear at the end of the post, type it yourself in the calculated field, do not copy/paste.
    If you have any doubt, feel free to send me the formula you used( and I’ll double check it.

    • I am having the opposite issue. Our SP Site is opening a new window which doesn’t load as well as opening into outlook. I want the “open a new window” to not happen. I merely want it to open outlook. We are also having an issue with clicking on an internal pdf opening in a new window when I want it to stay local. How can I fix this and is it possible that it is at the server level?

      • Jeremy, it’s hard to tell and will depend on the link. In some cases the behavior is driven by a script, this will be difficult to change (and specific to each case).

  4. Christophe – When creating a link, I’d like to be able to use the [Name] column (file name), but [Name] is not an available column when creating the calculated string. Is there a way to access the [Name] column in the formula so that it won’t have to be hardcoded?


  5. Sorry Mark, I am not aware of a way to use [Name] in calculated columns. Same issue for fields of type hyperlink, picture or lookup.

    If you don’t want to take the SharePoint Designer path, a trick would be to include some JavaScript in the upload form, that would capture the name and copy it to another field. This is risky, as changes happening outside the upload form (for example in explorer view) wouldn’t be captured.

  6. Hi, I had tried the method but couldn’t get it.
    Actually I’m trying to navigate my task records when I’m in the view/edit screen. I created a Calculated field with formula, =””&(ID-1), and I just want to display it as “Previous Rec” instead of the whole hyperline.

    Could I know how to do it?

  7. Hello

    Is it posible to remove the filtering row on top on the data rows? I’m using this trick to create a menu with links to other pages but I don’t like showing the name of the field as a filtering row. I don’t want people filtering the view.

    I’m using WSS 3.0.

    Best Regards

  8. Christophe, first of all thank you for your support.

    I’m using one links list for the whole site. The site has a lot of differente pages (it’s an Intranet) and each page has a link web part. In order to avoid a lot of links lists, I’ve just created one with some fields that work as filters. So when anyone creates a new page and needs a links list, the common links list is used and the user creates a new view for than page.
    In that case, the user shoudn’t be filtering, as what he’s seeing is the linsk for the specific page.

    Is it posible with Designer? Although I don’t have the tool I could ask some guys from other department to see if they can made the changes.

    Best regards

  9. Christophe, this does not seem to be working for me. I entered the following to test if it would work:


    But all got was the following line in the Column.


    I should expect only the word “TEST” in the column, correct? And if I press it, then it should should direct me to the url. Not working as expected though. Any help would be appreciated.

  10. So here is a question. When I set up new sites, on the home page I had a links list setup so users can add their own links and it would only display thier links, like a My Links view. When you add this link to the web zone it removes the column headers and creates a bulleted type list of the links. I created this custom list added it and it works perfectly, but I can not remove the column header, and I am not sure How I can make the view display as a bulleted list. Can this only be done with a links list?

  11. Larry, I also tried a “My Links” view in a department, but it never worked. People sticked to their browser bookmarks.
    Are you saying that you used the method described in this post? In this case, you should be able to get the bullets by adding a “li” tag in the formula.
    I often see questions about modifying the look of Web Parts (title background, remove buttons, hide column header), and I’ll publish a script for this. I have no magic trick, just regular CSS.
    What I usually do in such cases is create the view from scratch. For a list of links, I would for example:
    1/ grab the list content using the URL protocol:
    2/ use Javascript to make it a drop-down menu, like here:

  12. Duh, I should have thought about the li tags. That is simple enough. Ireading the rest of your solution I guess I was making it harder that I should. Sorry now I will shut up. Thanks again. If you are in the states, have a great holiday!

  13. Hi…

    I want that my hyperlink should ALWAYS open in a new window. Also tell me if there is any way to HIDE a column… 🙂

    Plz let me know about this asap…

  14. Nice one but your article on this isn’t clear enough.
    You stated:
    First, we create a custom list (Site Settings > Create > Custom list), call it “Microsoft newsgroups”, and add these four items:

    What type of colmn fields did you create e.g single line of text,hyperlink etc….

    I have created a calculated column and i have pasted this sample link
    =CONCATENATE(“Previous record“)

    But if i do:
    I can get a link but i want a link like the one you created

  15. Hi Christophe,
    I followed exact your steps
    = CONCATENATE (“”, [Title])
    And I got this error message:
    “The formula contains syntax error or is not supported”
    Did I miss something?

    • It’s due to the beginning blank space after the = sign
      i.e = CONCENATE … should be =CONCENATE

  16. Chelsea, I think the issue is with quotes formatting. I have corrected the post, note the subtle difference with what you pasted in your comment.

  17. Hi,
    Nice article ,if my list contains n number views,each views, i have to insert CEWP(java script code).is there any solution for this?

  18. sanjaya: the solution is to insert the script before creating the views. Once you have included a CEWP with the script in the main view, every new view you create based on the initial one will have the script included.
    Btw to facilitate later updates it is recommended to store the script in a document library and link to it from the CEWP.

    • Hi,

      We are having DailyTracker custom list to track daily project activities.In this list we have one column Department ( Type – dropdownlist ). Is it possible to open values appearing in Department dropdownlist as Lookup window similar to Person or Group window with option for user to select.

      I am new to SPS 2007. Please help me out.

    • Greg: I guess one solution would be to use a workflow to copy the hyperlink to a text column (but I haven’t tried).
      Another approach would be to use a script that will run on the page to identify the html hyperlink and extract the link URL. I did something similar once to extract the item id from the title column.

  19. Christophe – looks like this thread has been going for a bit –

    Glad I found it 🙂

    I’m trying to simply copy the 1st part of the concat script and getting an error thrown back at me:

    My Formula:
    = CONCATENATE (“”, [Title])

    The formula contains a syntax error or is not supported.

    WSS 3.0

    Any ideas?

  20. Good day Chris, first of all this is a very useful article.

    Here’s the scenario. I am building a pretty much like a records management system. For example I have created two lists, first is the List of Records, and the second one is the Request Form for the user to request any records.

    In the List of Records, I have created a calculated column named “Request this”. My suggestion is when user click the “Request this” link it will link to the (2nd list)Request Form’s New Item. Then user can fill in the details and then submit the form.

    Could u please help me in this area?

    Much Regards,

      • Thank you very much for the quick reply.

        I have already solved the problem. Apparently, i use ‘&’ instead of ‘,’ for the CONCATENATE parameters and it works.

        Thanks for the tips Chris. I have followed u on twitter.

        Have a nice day! 😀

  21. Christophe,
    Strange, but I was able to reference the ID in my calculated column that creates a URL string. My URL link needed to include a unique page to which the user should return based on Region. It works nicely, but now I want to wrap it in a hyperlink. I’ve been trying to follow instructions but get the “error in formula” message.

    Here is my URL output

    and here is my formula…

    =CONCATENATE(“”,ID,”&Source=”,[Calc aspx page])

    I’ll continue banging at it. Is it required that I have a “Open in New Window” column?

  22. SharePoint won’t give you an error message, but still ID is not in the list of allowed fields in formulas.
    If you don’t need the “open in new window” part, just remove the IF from the formula.

    • Christophe,
      I appreciate the feedback. Got it to work. I broke out the calculated column into two calculated columns. However, I may have to try another approach using workflow and a hyper link field. Here is why…

      The list in which I am trying to display the link is in datasheet view. When in DS view, the code is displayed. Is there a workaround for this other than the workflow option that I found here? (link and steps below)

      Again, a BIG thanks.


      = = = = = = = = = = = = = = = = = = = = = =

      What I normally do:

      Create an optional hyperlink column in the list

      Create a worklflow with SharePoint designer that starts on Item Created and with no conditions

      In the workflow, create an “Store dynamic string” action and store into a new variable.

      The dynamic string can then consist of your URL with lookups for any parameters you need. (Example: “[%YourItem:YourField%], Look up in google”. The comma and subsequent text makes sure it fits nicely with the Hyperlink data structure, where the latter part of the string becomes the displayed text for the link

      Then add another action “Set field to value”, where you select the field from step 1 and for the value, the variable created in step 4.

      Job done.

      Proposed As Answer byKale Davis Wednesday, October 14, 2009 12:39 PM

      • To use a regular link list how can we set this computing field please kindly advice. I am unable to get it working

  23. Question, my [title] column contains spaces which seems to cut off the URL when the first space is reached. Is there any way to account for spaces?

    Great article btw.

  24. Hi Cristophe,

    I followed your instructions but I can still see the tags and the clickable part it the one with the url. Here’s my syntax:


    Kindly correct.

  25. Hello Christophe,
    These instructions are exactly what I’m looking for and I’ve got it *mostly* working. The URL is formatted exactly like I want and have verified it will work. The only part not working is the script to transform it from text to html. I copied your script found in the link (, placed it in a text file and linked to it using the CEWP. Were there any changes you made to the script to get it to work on links instead of text formatting? Does the CEWP need to be last on the page or can it be first?
    Thanks for your help.

  26. hello ,
    Thanks for such article. i somehow cannot hide the long url that is diplayed in the calculated column. i have used custom new form for that particular list, and jqueries to create cascade dropdown.
    do u think that the already existing jquery is preventing this from working? i have even added a webpart (courtesy you), TextToHtml. even it has not helped.

    • Well, it should work if you followed the instructions in this post and included the TextToHTML.
      Test the customizations one at a time to try and isolate the issue. Sometimes the order may be important, I’d suggest for example to have TextToHTML before jQuery.

  27. Hi Christophe,
    Thanks for all your hard work. I love your solutions.
    I have an extra field to add to my Concatenation and I had it worked out fine.
    But when i go to try and enable the “Open link in new window” technique i just can’t get Sharepoint to accept my formula in URL column.
    I’ve included the working sample below and if you’re not too busy i would really appreciate the help to get the Pop-Up window working.


    Thanks very much

  28. Thank you for all the suggestions on this page. My problem is somewhat different. I would like to use your suggestion of “open in a new window” but change it to “open on side frame”. How do I get a list in one zone to open one of my calendar vies on a different zone on the same page.

    • While this can be done, I would not recommend to use my technique for this. You are mixing an item property with a page layout, and this is not consistent. Instead, I’d recommend to add a script to the page that will cnnect your hyprlinks to the frame.

  29. Thanks, most of it worked except for the last added column (Yes/No) which won’t show any checkboxes.???

  30. I tried your method, but field still dont looks like hyperlink, its just a simple text

  31. Great post! I have everything working except the CEWP for html conversion. I can get it working on any web pages that I create, but does this mean that I will never be able to convert to html when I’m viewing the list on the list page instead of another web page. If so, where do I put the CEWP. Thanks!

  32. After going over a few of the articles on your web page, I truly like your way of blogging.
    I book-marked it to my bookmark webpage list and will be checking back soon.
    Take a look at my web site as well and let me know how you feel.

  33. Hi Christophe:
    I am struggling with my formula.

    My list has these fields from which I need to create hyperlinks:
    [Open in new window?]

    I seem to be missing something in my formula. Would you see if you can spot my error?

    =CONCATENATE("<DIV><a href=’",[URL],[Title],IF([Open in new window?]=TRUE,"’ target=’_blank’ ","’"),">",[Title],"</a></DIV>")


    Charlie Epes

  34. This technique was working flawlessly in our SP2007 environment, however since the upgrade to SP2010 the calculated field is once again showing as raw data (<a href…

    Is there something in the java script that needs to change to make this work in SP2010?

    • Depending on your view options, the old code might not work in SP 2010. I’d recommend that you take a look at the posts published in 2010, where I shared some workarounds for SP 2010.

  35. Pingback: SharePoint Calculated URL Column. | Tjen Sharepoint Blog

  36. There are many possible solutions to make SharePoint Links to open in new window. Simple and easiest solution is: Create a Site column of “”Hyperlink with formatting and constraints for publishing” type and add it in your list, which enables you to specify “Open in New Window” Option!

    Find the all possible solutions, including JavaScript, JQuery to SharePoint Link list – Open in a New Window at:

    • Thanks for sharing the link. Funnily the article you are mentioning misses the solution presented in this post 🙂
      The “Hyperlink with formatting and constraints for publishing” is definitely an interesting choice, unfortunately it is not always available.

  37. Hi Christophe! I’d like to create a calculated URL – but based on an existing column which is a hyperlink. (cannot refer to column of type hyperlink when building formula for calculated column) – probably some workflow thing required, huh?

    • Because of the limitations with hyperlink columns, I usually prefer to store links in a simple text field.You are right, you could use a workflow to copy the link to a text field, but it’s a heavy workaround.

  38. Cristophe

    I have been playing with this on a SharePoint 365 site. The original calculated column technique generates the HTML fragment as described, but displays the raw HTML instead of a clickable link. However, if I change the formula data type to “Number (1, 1.0, 100)”, instead of “Single line of text”, the link works. Just one gotcha though, the column is right-aligned.

    I got the idea to try a Number column from:

    • Right, this number trick is also mentioned in the comments on this blog. I am not advertising it though, as it’s obviously a bug and I would expect Microsoft to fix this behavior in the future.
      The approach I recommend in SP 2013 / Office 365 is to rely on Client Side Rendering. I posted an article with sample code a couple months ago.

  39. Hi, it works perfectly!

    I juste have an issue with the “Open in new window” part. The formula is correct, it’s rendered as a link in the list, but it doesn’t open it in a new window, even with the yes/no column, the IF and [open in new tab?]=TRUE..

    Can you help me? Here is my formula :


    I use MOSS (SharePoint 2007), and I do have followed all the steps.
    I’m familiar with this stuff since I used yours “How to” for the Color Parts too 🙂

    PS: The formula is invalid if I remove the [myColumnToConcatenate]’s brackets.
    I know there is something, but i don’t see it, maybe an “other eye” will help me.

  40. Hi Christophe,

    I have the following fields in a custom list:

    “Title” – Single Line of Text, Required, Non-unique values, 255 chars, Default text (not used)
    “SC_URL” (Site Collection URL) – Single Line of Text, Required, Non-unique values, 255 chars. Contains the FQDN of the Site Collection
    “Site Settings” – Calculated column, data returned is Number.
    Formula for “Site Settings” is:
    =CONCATENATE(“<a href='[SC_URL]”,”/_layouts/settings.aspx”,”‘ rel=”nofollow”>”,”Site Settings”,”</a>”)
    – Sample value in “SC_URL” is
    – The list I’m using this in is in a different web application ( than the sample value (
    – The anticipated result is
    – The resulting URL is

    Any idea why this column is picking up my current webapp/managedpath/sitecollection/site/lists/listname instead of the URL in the Sample Value?

    Thanks in advance for your help, all your solutions have been a great value to my development activities!

    Best Regards,


Comments are closed.