现在的位置: 首页 > 综合 > 正文

有点想鄙视越南开发人员

2012年10月26日 ⁄ 综合 ⁄ 共 2316字 ⁄ 字号 评论关闭

昨天应越南客户之需,为他们加一地图,使用越南人自个儿提供的地图 vietbando map:

api: http://vietbando.vn/api/examplesE.aspx

结果在引入项目的时候,一直报参数错误。极为纳闷,弄了一个下午,最后没办法只有一个一个排除,排除到最后,将<html .....>修改成<html>就OK。

 

哎!!!! 真想鄙视他们。

 

心得:

    写接口还是要标准化一点,不然别人基于的接口开发时还真有点想 痛打 你一顿!!

 

 

解决方案:

 

X-UA-Compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与 content="IE=7"在无论页面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。对于多数网站来说,它是首选的兼容性模 式。

目前IE8尚在测试版中,所以为了避免制作出的页面在IE8下面出现错误,建议直接将IE8使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:

  1. <meta http-equiv="X-UA-Compatible" content="IE=7" />

这样我们才能使得页面在IE8里面表现正常!

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  1. <html xmlns="http://www.w3.org/1999/xhtml"> 
  2. <head> 
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  4. <meta http-equiv="Content-Language" content="utf-8" /> 
  5. <meta http-equiv="x-ua-compatible" content="IE=7" /> 
  6. <meta http-equiv="Pragma" content="no-cache" /> 
  7. <meta content="关注WEB标准,用户体验,关注前端技术,网页设计师,前端开发工程师,liupeng,Beijing China" name="keywords" /> 
  8. <meta content="关注WEB标准,用户体验,关注前端技术,网页设计师,前端开发工程师,liupeng,Beijing China" name="description" /> 
  9. <meta content="SaBlog" name="copyright" /> 

里面多了一句

  1. <meta http-equiv="X-UA-Compatible" content="IE=7" />  

X-UA-Compatible 是什么?

看看MSDN上的资料说明:

In IE8 Beta 1, that option is the “IE=7” X-UA-Compatible tag, which instructs IE8 to display content in IE7 Standards mode. However, the scenario this doesn’t address is when IE=7 is applied as an HTTP header to a site that contains Quirks mode pages. The IE=7 HTTP header will force all pages – both Quirks and Standards – to display in IE7 Standards mode. Developers using this header while updating their sites would then have to add the “IE=5” <META> tag to each page they want to keep in Quirks mode. This logic is fine for many websites. However, if a site has lots of Quirks mode pages, or for the case where pages with frames host a mix of Strict and Quirks mode content – as brought to light by IE8 Beta 1 user feedback – the compatibility opt-out adds a bit more work than we intended.

主要意思我总结一下:

X-UA-Compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与 content="IE=7"在无论页面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。对于多数网站来说,它是首选的兼容性模 式。

目前IE8尚在测试版中,所以为了避免制作出的页面在IE8下面出现错误,建议直接将IE8使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:

  1. <meta http-equiv="X-UA-Compatible" content="IE=7" /> 

这样我们才能使得页面在IE8里面表现正常!

 

参考资料:Introducing IE=EmulateIE7

 

 

 

抱歉!评论已关闭.