How to set the allow-file-access-from-files flag option in Google Chrome on the Linux Operating System

If you have ever tried to develop and test your application in Google Chrome on your local Linux machine you will most possibly face some challenges. It may be an App(Chrome extension development), an AJAX application using jQuery or offline javascript/html applications, you too may have experienced this issue.

Check Out The Solution

The Problem

The Google Chrome browser will not load local file by default due to security reason. The discussion has gone back and forth for the last 7 years and finally there is a reasonable workable solution.

The Solution

( or at least the last best alternative ).
Google Chrome has for a long time provided a list that shows the available switches including their conditions and descriptions. Using the --allow-file-access-from-files option you should be able to run your tests in Google Chrome with no hassles. Here’s how you do it on the various operating systems

On Linux Operating System

  1. Get the url of your Chrome Installation path to your chrome installation e.g C:\Users\-your-user-name\AppData\Local\Google\Chrome\Application>
  2. Launch the Google Chrome browser from the command line window with the additional argument ‘–allow-file-access-from-files’. E.g ‘path to your chrome installation\chrome.exe --allow-file-access-from-files
  3. Temporary method you can use each time you are testing
    - Copy the existing chrome launcher
    - Do as above and save it with a new name e.g chrome - testing
    - Alternatively, you can simply create a new launcher with the above and use it to start chrome.