postmanplod
Programmer
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
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