Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open PDF in new Window

Status
Not open for further replies.

postmanplod

Programmer
Aug 18, 2008
47
GB
Hey Folks,

I'm trying to figure out a solution to this problem that has been hanging over my head now for a while. Basically we have grouped lists of PDF's and when the user clicks these, we want them to appear in a new window. Now I know you can go into Acrobat Reader and untick to open in browser, but the client wants it performed all behind the scenes. So, steps I have performed so far:

- Downloaded a Jquery library here:
- Created a new file called: OpenPDF.js

- Pasted the following Code in the OpenPDF.js file:

$(document).ready(function() {
$("a[href$='.pdf']").removeAttr('onclick').attr("target","_blank");
});


- Uploaded both files to the newly created ScriptLibrary.


- Navigated to the List Page that has the PDF's

- Clicked Site Actions: Edit Page, Insert > Content Editor WebPart

- Clicked to Edit the HTML Source of the HTML WebPart, then pasted in the following to reference the two files that I uploaded to your Script Library:



<script type="text/javascript" src="/dhtpump/InformationSystems/ISTeam/ScriptLibrary/jquery-1.4.4.min.js" ></script>

<script type="text/javascript" src="/dhtpump/InformationSystems/ISTeam/ScriptLibrary/OpenPDF.js" ></script>

- Saved the page.

Nothing happens - where have I gone wrong?

Regards,

Michael
 
Hello,

Thank you for the reply.

I'm pretty new to sharepoint and java script. Where would I put $("#MSO_ContentTable").text("Welcome to Sharepoint jQuery")?

Regards,

Michael
 
Mmmm it still doesn't work. The list of pdf's are also grouped.....
 
I created a new library and put them in there - I was told not to put it at the root though - does this matter?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top