js调用本地文件(IE)

<script> 
function openlocal(){ 
             var shell = new ActiveXObject("WSCRIPT.Shell");   
             shell.Run("c:\\book.txt",1);   
        } 
</script> 

  

html调用:

<a href="javascript:openlocal()">open local file</a>

  

不过仅限于IE浏览器和必须加载activeX插件,调用shell时候只能用绝对路径。

转载于 http://sunhuang.blogbus.com/logs/35469521.html

原文地址:https://www.cnblogs.com/nishilunhui/p/2631616.html