需要通过javascript 实现

index.html

<a href=# onclick="window.open('temp.html');return(false);">下载文件</a>

 

temp.html  //被下载文件

//需要使用以下javascript代码
  <Script language="javascript">
  if (typeof(window.opener) != 'undefined')   //判断 打开方式的下载。 去掉会一打开文件就弹出下载框
  {
   document.execCommand('SaveAs');
   window.close();
  }
  </Script> 

//然后做一个下载按钮
<button onclick="javascript:document.execCommand('SaveAs');">保存本页面</button>


http://www.dedecms.com/web-art/PHP_jiaocheng/20060913/30947.html
来源:Blog.ChinaUnix.net

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2022-01-20
  • 2021-04-30
  • 2021-05-24
  • 2021-11-22
  • 2022-12-23
猜你喜欢
  • 2021-05-05
  • 2022-12-23
  • 2022-02-10
  • 2021-11-01
  • 2021-09-11
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案