点击下载链接弹出空白页面

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u014018281/article/details/79786289

分为两种情况

如果下载由js触发而非a标签,则可以在弹出的页面中进行如下修改:

<head>与</head>之间加入:
<base target="tempiframe" /> 
在<body></body>加入:
<iframe name="tempiframe" style="display:none;"></iframe>

如果为超链接,则可以如下处理:
页面内链接写法如下:
<a target="tempiframe" href="请求下载的地址">下载pdf文档</a>
并且在<body></body>加入:
<iframe name="tempiframe" style="display:none;"></iframe>


猜你喜欢

转载自blog.csdn.net/u014018281/article/details/79786289
今日推荐