Force download a pdf link using javascript/ajax/jquery

前端 未结 7 2017
夕颜
夕颜 2020-11-27 04:51

suppose we have a pdf link \"http://manuals.info.apple.com/en/iphone_user_guide.pdf\"(just for example and to let u know that file is not on my server, i only have the link)

7条回答
  •  执笔经年
    2020-11-27 05:27

    With JavaScript it is very difficult if not impossible(?). I would suggest using some sort of code-behind language such as PHP, C#, or Java. If you were to use PHP, you could, in the page your button posts to, do something like this:

    
    

    This also seems to work for JS (from http://www.phpbuilder.com/board/showthread.php?t=10149735):

    
    
    
    Download this pdf
    
    

提交回复
热议问题