我是靠谱客的博主 柔弱白猫,这篇文章主要介绍html下载本地,现在分享给大家,希望可以做个参考。

通过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下载本地的全部内容,更多相关html下载本地内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(139)

评论列表共有 0 条评论

立即
投稿
返回
顶部