-
-
Save ahhqcheng/5428338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Make sure you have nginx sub module compiled in | |
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module' | |
# 2. add two directives below at HTTP level | |
# nginx.conf | |
http { | |
# ...... | |
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); } img { _filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=0); -webkit-filter: grayscale(100%); } </style>'; | |
sub_filter_once on; | |
# ...... | |
} | |
# 3. nginx -t && /etc/init.d/nginx reload | |
Notes: | |
1. Does not work on Firefox | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment