Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

how to open the URL into a new window in links webpart?

  Asked By: Marissa    Date: Jun 11    Category: Sharepoint    Views: 6890

I have a quick question, how to open the URL into a new window from links webpart, I added some URL there but they open in the same window of sharepoint and I have to go back to work on sharepoint again, I want to open them into a new separate window?



4 Answers Found

Answer #1    Answered By: Donta Kirkland     Answered On: Jun 11
Answer #2    Answered By: Cade Velazquez     Answered On: Jun 11

Check out my "Open List Items in a New Window (_blank)" post:

Answer #3    Answered By: Ariana Christensen     Answered On: Jun 11

Also, if you fancy modifying the CAML used to define/generate the list, you can
modify the schema.xml for the links  list. I needed to to similar recently (open
a link in an iframe, rather than a new window  but the principle is the same), I
found this


which details modifying the xml. I'm not sure if this is a better/easier/etc way
to do it, but it worked for me!

Answer #4    Answered By: Darrius Whitfield     Answered On: Jun 11

After getting the help from all of you, I am able to open  the list items into a new window, It was done after installing the webpart  which open items into a new window, but I am still trying to open the links  into a new window.

I got one script which was asked to add into a ows.js file, but I could not do that, i added  into the file but it removed the entries from the add link screen and there was no input field when I added the script into the ows.js file.

var theLinks = document.links ;
var thisDomain = window.location.hostname;

// Edit "theMessage" to your liking
var theMessage = "You are now leaving " + thisDomain + ". The content of the requested web site is outside our control. The requested web page will open in a new window. You may click \"Cancel\" to stop loading the requested page. You may need to hold your CTRL key down when pressing \"OK\" to bypass your pop-up blocking software.";

// Change "showMessage" to 0 if you don't want the warning to pop up when navigating to external sites.
var showMessage = 1;

function updateLinks() {
for (i=0; i < theLinks.length ; i++) {
var thisLink = theLinks[i];
if (thisLink.href.indexOf(thisDomain) == -1 && thisLink.href.indexOf("javascript") == -1) {
thisLink.target = "_blank";
if (showMessage == 1) {
thisLink.onclick = confirmNav;

function confirmNav() {
return confirm(theMessage);

document.body.onload = updateLinks;
After that the latest solution which is Schema.xml, It is very useful but I am not sure in which website I do need to added the line, I mean which schema.xml needs to be changed , I found so many files on server.

Add New Field "Open In New Window"
The first thing we need is a new boolean field that we'll use to hole the flag if the link should be opened in a new window. We do this by adding a new <Field> element in the <Fields> section of the SCHEMA.XML file. Look for the line that defines the URL field (on or about line #11) that looks like this (take note the type is URL… we'll revisit this in a second):
<Field Type="URL" Name="URL" DisplayName="URL" Required="TRUE" FromBaseType="TRUE"></Field>
Let's add a new field just after this line:
<Field Type="Boolean" Name="OpenInNewWindow" DisplayName="Open in New Window" Required="TRUE"></Field>

The attributes say that this field is of type boolean (the user will be presented with a checkbox), the unique ID of the Field (Name), the friendly display name, and if the field is required on this list. If a field is required, the field can't be removed from the list.

Didn't find what you were looking for? Find more on how to open the URL into a new window in links webpart? Or get search suggestion and latest updates.