Cordova Browser Platform Support on Linux
I’m working on a new mobile application which, of course, means Cordova. Recently Cordova added the “browser” platform so you can test your application right on the desktop with no hackery required.
Getting the platform added to your project and run it as a browser app is as simple as:
cordova platform add browser
cordova run browser
I, however, am on Linux and when I first tried to run on the browser platform I only got a blank output with no browser. Lame sauce. The solution is to patch the script used by Cordova to launch the browser.
case 'linux':
spawn('/usr/bin/google-chrome',['-n', '-a', '--args', '--disable-web-security', '--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser', project] );
break;
Make sure to modify the path to Chrome if needed.
UPDATE: I’ve since discovered you can pull an updated script from Cordova’s GitHub.
About the author
Brooks Garrett is a dedicated technologist who specializes in information security. Brooks has spent over 10 years implementing security programs for both the public and private sector including some of the biggest names in the Fortune 500. When he's not managing risk in the corporate environment you can find him at the local firestation where he is a volunteer firefighter.