2015-12-06 68 views
0

我通过Cordova(vs)创建了一个andriod应用程序。如何在Cordova中通过Android浏览器打开Html文件(* .html)

我想在android操作系统中通过浏览器打开一个html文件(来自SDcard)。

所以我用下代码(与InAppBrowser插件):

var path = cordova.file.externalRootDirectory + "file.html"; 
window.open(path, '_system'); 

但我的问题是,html文件由HtmlViewer开放而我想通过浏览器打开。

该怎么办?

回答

0

为什么不使用document.write()而不是加载文件?

<script> 
    var html = "<html>" + 
      "<body>" + 
      "here's your html file content" + 
      "</body>" + 
      "</html>"; 
    document.write(html); 
</script> 
相关问题