Category Archives: Chrome

Chrome – Bypass Access-Control-Allow-Origin on Mac

About a year ago, i posted an article about allowing the Javascript accessing the local file system in order to read the local JSON file.

 

So if you are using Mac, you need to quit the Chrome application. Then execute the following command in Terminal.

/usr/bin/open -a "/Applications/Google Chrome.app" --args --allow-file-access-from-files

 

Reference: Disable same origin policy in Chrome on Mac OSX

Chrome – Bypass Access-Control-Allow-Origin on local file system

Just wanna do some proof of concept on reading a JSON file in Javascript. So i open the index.html and read the JSON file locally. But the Chrome console throw the Access-Control-Allow-Origin error.

  • XMLHttpRequest cannot load file:///C:/Users/user/Desktop/readJson/data/file-1.json. Origin null is not allowed by Access-Control-Allow-Origin.

Although it should work if i upload those sources files to a web server, i would still make it work locally especially for development purpose. So here is a small trick which could ask the Chrome browser to bypass this cross-domain restriction.
Continue reading Chrome – Bypass Access-Control-Allow-Origin on local file system

CSS – Make font-size smaller than 12px in Chrome

In Chrome, the displayed text has a minimum font-size 12px even thought you set a smaller value in CSS. This is because the Chrome browser has a auto font adjustment.

So if you want to style a text with font-size smaller than 12px, include the following line in your CSS file.

body {
  -webkit-text-size-adjust: none;
}

 

Done =)

Reference: StackOverflow – Font-size <12px doesn't have effect in Google Chrome