I have some jquery(as suggested by someone on StackExchange) to open PDFs in a new browser window from the out of the box search restuls web part.

The code works in Chrome and Firefox but not IE8. Can anyone help me identify why?

<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("a[href$='.pdf']").attr("target", "_blank");       

Thanks in advance

1 Answer 1


Here's a script I've used that works for me in IE8. It works best in IE8 with jQuery version 1.8.2 in my case.

$(".srch-Title3 a").click(function() {
    href = $(this).attr("href").toLowerCase();
    if (href.indexOf(".pdf") !== -1) { 
        window.open(href, "_blank"); 
        return false; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.