步骤如下:
1、重新编译Nginx,增加http_sub_module模块:
wget https://nginx.org/download/nginx-0.8.39.tar.gz
tar zxvf nginx-0.8.39.tar.gz
cd nginx-0.8.39
./configure –user=www –group=www –prefix=/usr/local/webserver/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module
make && make install
pkill -9 nginx
/usr/local/webserver/nginx/sbin/nginx
在nginx.conf配置文件的http {…}大括号内增加以下两行:
sub_filter ‘</head>’ ‘<style type="text/css">html {filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }</style></head>’;
sub_filter_once on;
保存后,重新加载配置文件:
/usr/local/webserver/nginx/sbin/nginx -t
/usr/local/webserver/nginx/sbin/nginx -s reload
如果某些带有Flash的页面仍显示彩色,或浏览器上下滚动条拖动时Flash FLV播放器变花(例如剑网3、剑侠世界官网分流页),将Flash改为JS输出(本例为SWFObject):
<script type="text/javascript" src="https://v.xoyo.com/site/v.xoyo.com/web/js/swf.js”></script>
<div id="video_content"></div>
<script type="text/javascript">
<!–
var video_player_so = new SWFObject("https://api.v.xoyo.com/external/player.swf?autostart=true&config=https://api.v.xoyo.com/external/video-542.swf", "sotester", "439", "246", "7");
video_player_so.addParam("wmode", "opaque");
video_player_so.addParam("allowfullscreen","true");
video_player_so.addParam("allowscriptaccess","always");
video_player_so.write("video_content");
//–>
</script>
原创文章,转载请注明: 转载自混沌
本文链接地址: 响应号召,页面变灰(方法转自张宴博客)