前段时间老司机帮我们给论坛升级为https,但是出现了验证码刷新不出来的问题。
后来用F12检查,提示如下错误
Refused to execute script from ‘https://www.xxx.com/misc.php?mod=seccode&action=update&idhash=xxxxxxxxxx&modid=member::register’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
后来上网查了一下,其实是最近Chrome的更新,将会对文件类型的检查更为严格,如果文件类型不一致,将无法加载。
解决方法也很简单
进入”<DiscuzRoot>/source/module/misc/” 目录,打开misc_seccode.php,然后找到63行,内容为
echo <<<EOF if($('$showid')) { if(!$('v$showid')) { var sectpl = seccheck_tpl['$idhash'] != '' ? seccheck_tpl['$idhash'].replace(/<hash>/g, 'code$idhash') : ''; var sectplcode = sectpl != '' ? sectpl.split('<sec>') : Array('<br />',': ','<br />',''); var string = '<input name="seccodehash" type="hidden" value="$idhash" /><input name="seccodemodid" type="hidden" value="$modid" />' + sectplcode[0] + '$seclang[seccode]' + sectplcode[1] + '<input name="seccodeverify" id="seccodeverify_$idhash" type="text" autocomplete="off" style="{$imemode}width:100px" class="txt px vm" onblur="checksec(\'code\', \'$idhash\', 0, null, \'$modid\')" />' + ' <a href="javascript:;" onclick="updateseccode(\'$idhash\');doane(event);" class="xi2">$seclang[seccode_update]</a>' + '<span id="checkseccodeverify_$idhash"><img src="' + STATICURL + 'image/common/none.gif" width="16" height="16" class="vm" /></span>' + sectplcode[2] + '<span id="v$showid">$message</span>' + sectplcode[3]; evalscript(string); $('$showid').innerHTML = string; } else { var string = '$message'; evalscript(string); $('v$showid').innerHTML = string; } $htmlcode } EOF;
在echo上一行加上
header('Content-Type: text/javascript');
即可解决。
话说没有解决诶。。。现在是验证码在chrome里不显示,但是IE完全没问题Orz
你开F12看看报错是什么