I typically use Chrome with JavaScript disabled via the Content Manager, allowing certain sites via exception match rules.

I've tried writing an exception rule to allow JavaScript on pages that are running locally from the file system so I can test sites being developed.

The location of pages being tested is file:///C:/Development/ProjectName/example.html so I tried adding an exception rule of file:///C:/Development/* but Chrome fails to match the rule with anything.

match rule fail

The following rule works file:///* so I am curious as to why the previous rule does not.

What is it about this rule file:///C:/Development/* that Chrome does not like?

  • Have you tried it without the 'file:///'? So just your path, C:/Development/* - as you would see it in Windows Explorer, plus the wildcard? – David May 26 '16 at 22:34
  • @David: I've tried using with and without the file:/// bit and neither are accepted. Only the full path or file:///* work. – AlainD Jan 4 '17 at 22:11

This is unfortunately not possible. The specification for chrome.contentSettings pattern matching states:

For http, https, and ftp URLs, the path must be a wildcard (/*).
For file URLs, the path must be completely specified and must not contain wildcards.

See this Chrome developer page for additional details. This is unfortunate! Perhaps Google will allow this form of wildcard pattern matching for file or directory resources in the future. In the meantime, you have a few options:

* Temporarily allow JavaScript to run on all sites
* Use the general `file:///*` wildcard you discovered
* Set up an exception for each file you develop on

My own preference is the last option. You just need to remember to clean up the exceptions every so often (not a huge burden).

| improve this answer | |
  • I'm current doing the latter option, creating specific exceptions and doing weekly clean ups. – matt. Jan 4 '17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.