Wednesday, July 9, 2008

Open documents in new window

Hi All,

Let's take one scenario where your client does not have office installed and you also want to deal with document library.

Now we know that there is a settings in document library settings that if client do not have office installed at machine, then MOSS will automatically open document in the browser window. it automatically check for the availability of office at client side and if not found then opens it in same browser.

The settings for this is as follows :

(1) Go to your document library.
(2) Click on Settings-> document library settings
(3) Click on advanced settings
(4) Check for "Browser-enabled Documents" section and select Display as a Web page.
(5) Press OK.

Now you have set this option and if your client does not have office installed then MOSS will automatically open document in browser.

but but but.....notice that it opens in same browser...So if you want that document opens in new windows, not in the same browser then.....???

so Here is a trick to go for it :

But remember that this change will apply to all document libraries of all web applications. Because we are going to change the Global onet.xml. So be aware..

Here we go..

(1) Open C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML

(2)Open ONET.XML

(3)Search for this line <Else><HTML><![CDATA[<A onfocus="OnLink(this)" HREF="]]></HTML>

(4)Change it to <Else><HTML><![CDATA[<A onfocus="OnLink(this)" target="_new" HREF="]]></HTML>

(5)Find one more line : <Else><HTML><![CDATA[<A TABINDEX=-1 HREF="]]></HTML>

(6)Change it to <Else><HTML><![CDATA[<A TABINDEX=-1 target="_new" HREF="]]></HTML>

(7)Rest the IIS and just check.....

now all documents will open in new window..

Thanks to Jonathon for this wonderful idea..for more information visit here

19 comments:

Anonymous said...

You are saving a life with this article. Thanks!!!

shmoo said...

We can't make this work for pdf files. Is there a way?

Anonymous said...

shmoo, Have you tried with PDF files?

Anonymous said...

Thanks for the post it working for me......

Unknown said...

Is there a way when clicking an item in a list view to edit or view that item, it will not changing the current web page but instead pop up a window to edit/view?

Anonymous said...

If I don't have access to sharepoint server, can I still make changes to onet.xml file? I can open the site in Sharepoint designer, but I cannot find the onet.xml from any folders.

SharePoint Kings said...

you should have access on the server if you want to change ONET.xml

Anonymous said...

Does this apply to SharePoint 2010 as well or is there something different that need to be modified? The first string is in the file but I was not able to locate the second string to modify and update.

SharePoint Kings said...

Anonymous,

we had not checked it on 2010 but definitely its working in 2007

Amit Hiremath said...

For this to work first we have to get SharePoint 2007 to open the documentsin browser windows rather than application. Please refer my blog below for the same.
http://ebsolute.com/blogs/?p=50

SharePoint Kings said...

Amit,

we think your trick is good but its different from our concept.

but still its quite helpful.

Anonymous said...

This doesn't work with 2010.. Any tip? Thx

Anonymous said...

How can i set the document in a document library to open in a new browser window in sharepoint 2010. I have successfully done this in MOSS 2007 but when i try to use same steps in sharepoint 2010 its not working.

Could any one please let me know what is the process to open a document in a document library to in a new browser window in sharepoint 2010

Appreciate your help.

SharePoint Kings said...

we had not tested it in sharepoint 2010. and as per comment it might not work in 2010 as it had some upgrade at field level.

mean while work around like this link http://www.sharepointkings.com/2011/05/opening-any-sharepoint-page-as-model.html can be done but its just for reference, its different from exact requirement.

Anonymous said...

I already changed the file ONET.XML, I am just a little bit lost on the last step. Is it rest or reset the IIS (stop/start ISS)? Could you please give more details...Thanks!!

SharePoint Kings said...

its IIS reset (stop/start)

run-->iisreset command

Teija said...

I opened ONET.XML in Notepad++ and searched for the code snippet. There are 11 occurrences of it in that file. Do I only need to change the first two??
Thank you!

SharePoint Kings said...

@Teija, are you sure you search exactly mentioned text?

alex said...

Teija,
you should only modify it for Document library base type. I.e. find occurrences within this parent tag only:

...




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com