weixin_33712881 2016-01-08 11:31 采纳率: 0%
浏览 13

找不到处理文件

I have a link say TestLink.

Clicking on which normally yields me a pdf. Sometimes it diplays a page in a new window with message file not found

I need to respond when second case happens ,how do i handle this case via javascript?

  • 写回答

1条回答 默认 最新

  • weixin_33733810 2016-01-08 11:40
    关注

    You could use jQuery

    $.ajax( "http://link.to.pdf" )
     .fail(function() {
         // ... disable the link --> PDF is not reachable
     });
    

    source

    You can check the link, if the PDF is not reachable disable the link.

    评论

报告相同问题?