通过javascript 实现

index.html

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

#######

temp.html  //被下载文件

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

################

<button onclick="javascript:document.execCommand('SaveAs');">保存本页面</button>

以上就是【html下载本地】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论