1

I have cordova app which loads the corretc html files needed at runtime, this works fine when launched as an app. Is it possible to test this functionalty in chrome as this would speed up development a lot.

To start I have opened chrome from the cmd line with

C:\installationpath\chrome.exe --allow-file-access-from-files

As also stated here but this gives me the same error:

XMLHttpRequest cannot load file:///C:/myworkdir/myfile.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

And also added this for jquery mobile:

$(document).bind('mobileinit',function(){
   $.support.cors = true;
   $.mobile.allowCrossDomainPages = true;
   $.mobile.changePage.defaults.changeHash = false;
   $.mobile.hashListeningEnabled = false;
   $.mobile.pushStateEnabled = false;
});

Is there a way around this or should I just work directly on the app using chrome://inpsect to debug as I'm building

if it helps the function in the app:

function includePage (file, callback){ 
    $.get(appFiles + 'layout/' + file.name + '.html')
    .success(function(html) { 
        $('#AppBody').append(html); 
        if(file.active){ 
            $.mobile.changePage(file.id,{changeHash: false}); 
        }
        if(callback !== undefined || callback !== null){ 
            callback(); 
        }
    });
};

This function works fine on my app

Community
  • 1
  • 1
Paul Ledger
  • 1,125
  • 4
  • 21
  • 46
  • Possibly related, but it may only be true for extensions, not apps: http://stackoverflow.com/questions/17155916/can-an-app-or-extension-open-files-on-system-with-permission-all-urls/17156345#17156345 – apsillers Feb 16 '16 at 15:03

1 Answers1

1

Try:

C:\installationpath\chrome.exe --allow-file-access-from-files --disable-web-security
DaveAlden
  • 30,083
  • 11
  • 93
  • 155