user1882752
user1882752

Reputation: 576

Cordova downloaded html file not accessible with VKwebview iOS

Using the contentsync plugin, I am downloading html from my server. The files are downloaded and I get the save path etc.

When trying to load the html into a div using jquery, VKwebview does not allow the loading of file://path_to_resource. There is no error, the view is just blank.

On an android device, the code works so I am fairly certain that it is the VKwebview

function startSync() {

var sync = ContentSync.sync({ src: imageZip, id: 'kittenZip' });

sync.on('progress', function(data) {
    imageDiv.innerHTML = "<p>Syncing images: "+data.progress + "%</p>";
});

sync.on('complete', function(data) {
    console.log(data.localPath);
    $('#html_div').load("file://" + data.localPath + "/index.html") 
}
    
});

sync.on('error', function(e) {
    console.log('Error: ', e.message);
    // e.message
});

sync.on('cancel', function() {
    // triggered if event is cancelled
}); 

}

Upvotes: 0

Views: 180

Answers (1)

Eric
Eric

Reputation: 10658

You can install cordova-plugin-ios-xhr and set your preferences to

 <preference name="allowFileAccessFromFileURLs" value="true" />
 <preference name="allowUniversalAccessFromFileURLs" value="true" />

This should solve the file:// issue

Upvotes: 1

Related Questions