Mahdi Radi
Mahdi Radi

Reputation: 449

How Open Html File (*.html) by Android Browser in Cordova

I create a andriod application by Cordova (in vs).

I want to open a html file (from SDcard) by browser in android OS.

so i use under code (with InAppBrowser Plugin):

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

but my problem is that the html file open by HtmlViewer Whereas i want open by browser.

how can do that?

Upvotes: 0

Views: 1167

Answers (2)

suraj mahajan
suraj mahajan

Reputation: 870

try phonegap's file opener plugin https://github.com/pwlin/cordova-plugin-file-opener2

Upvotes: 1

l3est
l3est

Reputation: 417

Why don't you use document.write() instead of loading file ?

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

Upvotes: 1

Related Questions