文章摘要
文章讨论了在使用FCKeditor时遇到的浏览器兼容性问题,特别是Chrome环境下显示不正常。为解决此问题,作者分享了以下关键点:
1. **FCKeditor显示问题**:在某些浏览器中,由于路径问题或兼容性不足,FCKeditor无法正常显示内容,导致空白页面。
2. **解决方法**:
- **调整相对路径**:修改FCKeditor的BasePath和UserFilesPath,确保其在不同浏览器中的正确路径。
- **兼容性检测函数**:通过修改JavaScript函数,增加了对Chrome浏览器的识别,使得在Chrome下FCKeditor能够正常显示。原函数检查了MSIE、Gecko和Opera等浏览器,修改后新增了对Chrome的支持。
3. **年份获取问题**:在Chrome环境中,建议使用`getFullYear()`函数来获取年份,而非`getYear()`。
文章还引用了相关解决方案的文章,供用户参考。
总结:通过调整路径设置和修改兼容性检测函数,可以在不同浏览器中正常使用FCKeditor,并解决了在Chrome中获取年份的问题。
网上有人说如下修改就可以,不过也要看你用的是什么系统,程序员的水平就决定了兼容性问题,不过可以试试。
this.EnableSafari=true ; // This is a temporary property, while Safari support is under development.
把false修改为true之后显示正常
应该是chrome使用的内核WebKit的问题,需要修改safari的支持
建议以后广大程序员开发的时候要注意浏览器的兼容性问题。
fckeditor 没显示有问题
没一点格式 参考下吧
<html>
<head>
<script src=https://www.jb51.net/fckeditor/fckeditor.js”></script>
</head>
<body>
<form action=”shou.jsp” method=”post” target=”_blank”>
<script>
var editor=new FCKeditor(‘message’);
editor.BasePath=’/fckeditor/’;
editor.Height=280;
editor.ToolbarSet=’Default’;
editor.Create();
</script>
<input type=”submit” value=”提交” name=”button”>
</form>
</body>
</html>
FCKeditor 没显示,出现空白页面
路劲问题吧 在web.config 里面设置fck的相对路径
<appSettings>
<add key=”FCKEditor:BasePath” value=”/FCKeditor”/>
<add key=”FCKeditor:UserFilesPath” value=”/UploadFiles/”/>
</appSettings>
上面的是你Fck所在的相对路径
下面的是fck上传文件的文件夹路径不过脚本之家今天弄得一个后台由于是老板本,他使用了php判断当前浏览器与版本,chrome下编辑就不会出现的。需要修改一下函数就可以了。
原来的函数
function IsCompatible()
{
global $HTTP_USER_AGENT ;
if ( isset( $HTTP_USER_AGENT ) )
$sAgent=$HTTP_USER_AGENT ;
else
$sAgent=$_SERVER[‘HTTP_USER_AGENT’] ;
if ( strpos($sAgent, ‘MSIE’) !==false && strpos($sAgent, ‘mac’)===false && strpos($sAgent, ‘Opera’)===false )
{
$iVersion=(float)substr($sAgent, strpos($sAgent, ‘MSIE’) + 5, 3) ;
return ($iVersion >=5.5) ;
}
else if ( strpos($sAgent, ‘Gecko/’) !==false )
{
$iVersion=(int)substr($sAgent, strpos($sAgent, ‘Gecko/’) + 6, 8) ;
return ($iVersion >=20030210) ;
}
else
return false ;
}
修改后的函数
function IsCompatible()
{
global $HTTP_USER_AGENT ;
if ( isset( $HTTP_USER_AGENT ) )
$sAgent=$HTTP_USER_AGENT ;
else
$sAgent=$_SERVER[‘HTTP_USER_AGENT’] ;
if ( strpos($sAgent, ‘MSIE’) !==false && strpos($sAgent, ‘mac’)===false && strpos($sAgent, ‘Opera’)===false )
{
$iVersion=(float)substr($sAgent, strpos($sAgent, ‘MSIE’) + 5, 3) ;
return ($iVersion >=5.5) ;
}
else if ( strpos($sAgent, ‘Gecko/’) !==false )
{
$iVersion=(int)substr($sAgent, strpos($sAgent, ‘Gecko/’) + 6, 8) ;
return ($iVersion >=20030210) ;
}
else if ( strpos($sAgent, ‘Chrome’) !==false )
{
return 1;
}
else
return false ;
}
经过测试这样就正常显示了,解决问题。还有个问题那就是chrome下获取日期不能用getYear,需要用getFullYear(),但也有更好的解决方法,大家可以参考这篇文章。
您可能感兴趣的文章:ie9后浏览器fckeditor无法上传图片、弹出浮层内容不显示的解决方法fckeditor在ie9中无法弹出对话框的解决方法(弹出层兼容问题)解决FCKEditor在IE10、IE11下的不兼容问题