When you’re developing a mobile website – or, in my case, an phonegap mobile app with a web based GUI – you can setup a server on your mac or you can choose to activate file referencing.
Not every browser supports the file access; Firefox and Google Chrome are your best bet to ride on with this. Since I don’t really like the latest Firebug interface in Firefox anymore I wanted to use Chrome for my project.
It appears, you have to run your Chrome with some arguments in order to enable file access on your Windows / Mac machine.
Here is the Mac command to make your project blast off:
'open -a "Google Chrome" --args --allow-files-access --allow-file-access-from-files'
The command explained:
- Open with the -a parameter will run the application without you needing to dive into the .app package to find the executable.
- The first –args parameter enables argument passing to the app.
- Secondly, the –allow-files-access enables you to use links that are opened with the file:// protocol (which is the case when you’re not using a local server to run your webfiles.
- Last but not least, the –allow-file-access-from-files enables the old file access mode to just run a local file like in the old days.
How did I get this wise? I found the parameters here.
Remember to use both arguments else you will get weird cross origin console errors and your files will look like they’ve had an tsunami to deal with.