Quick Tip: Fix Cordova Access-Control-Allow-Origin error


A real lifesaver for cordova and ionic developers when you encounter CORS errors in the browser preview – Goto yourapp/platforms/browser/cordova/node_modules/cordova-serve/src/browser.js and change the chromeArgs line, adding the “–disable-web-security” flag:

function getBrowser(target, dataDir) {
dataDir = dataDir || 'temp_chrome_user_data_dir_for_cordova';

var chromeArgs = ' --user-data-dir=/tmp/' + dataDir + ' --disable-web-security';

Credit: vxlabs

Quick Tips: Snippets from the web I found useful, mainly here for my own reference

,