确保网页在IE6、IE7下的表现:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
IE=edge告诉IE使用最新的引擎渲染网页,chrome=1则可以激活Chrome Frame
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
确保网页在IE6、IE7下的表现:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
IE=edge告诉IE使用最新的引擎渲染网页,chrome=1则可以激活Chrome Frame
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
优缺点:
使用场景:
使用GeoLocation API获取地理位置:
navigator.geolocation.getCurrentPosition(GetLocation);
function GetLocation(location) {
alert(location.coords.latitude);
alert(location.coords.longitude);
alert(location.coords.accuracy);
}
Viewport argument value "device-width;" for key "width" is invalid, and has been ignored. Note that ';' is not a separator in viewport values. The list should be comma-separated.
页面上写:
<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0" name="viewport" />
会报如上的一些警告。
解决方法:(逗号替代分号,分号在html中代表结束)
querySelector 和 querySelectorAll 方法是 W3C Selectors API Level 1 规范中定义的。他们的作用是根据 CSS 选择器规范,便捷定位文档中指定元素。 支持情况:目前几乎主流浏览器均支持了他们。包括 IE8(含) 以上版本、 Firefox、 Chrome、Safari、Opera。
它们俩是有区别的:
记住:jquery与它俩是有区别的
<link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait)" href="ipad-portrait.css" />
<link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape)" href="ipad-landscape.css" />
减少网络请求,使用下面:
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
.ipad-portrait { color: red; } /* your css rules for ipad portrait */
}
/* All Smartphones in portrait and landscape ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* YOUR STYLE GOES HERE */
}
/* All Smartphones in landscape ----------- */
@media only screen
addEventListener我们一般会这样用:
element.addEventListener(type,callback,useCapture)
为了兼容__<IE9__:
if (el.addEventListener) {
el.addEventListener('click', modifyText, false);