检查浏览器是否处于怪癖或标准模式? [英] Check whether browser is in quirks or standards mode?

查看:74
本文介绍了检查浏览器是否处于怪癖或标准模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了以下还有其他方法:

document.compatMode ==''CSS1Compat''


<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 // EN"

" http://www.w3.org/TR/html4/strict.dtd">

< html>

< head>

< meta http-equiv =" content-type" content =" text / html; charset = utf-8">

< title>虚拟图书馆< / title>

< script type =" text / javascript">

<! -

函数init(){

window.status =''你在''

+((document.compatMode ==''CSS1Compat'')?''标准'''''Quirks'')+''模式。''

}

window.onload = init;

// - >

< / script>

< / head>

< body>

< p> Howdy< / p>

< / body>

< / html>

解决方案

Harry Haller写道:


除了以下还有其他方法:

document.compatMode ==''CSS1Compat''



其他方式是什么?哦,问题出在主题领域:


检查浏览器是否处于怪癖或标准模式?



没有更好的方法可以想到,但使用书签会更方便:

http://dorward.me.uk/www/bookmarklets/qors/


Osmo


4月4日,08:30,Harry Haller< H ... @ Steppenwolf.com写道:
< blockquote class =post_quotes>
除了以下还有其他方法:

document.compatMode ==''CSS1Compat''



只需编写文档,以便将浏览器设置为标准

模式。这个列表很模糊,但它是确定性的。浏览器不会因为星期四而在模式之间翻转。


Harry Haller< Ha * **@Steppenwolf.com写道:


除了以下还有其他方法:

document.compatMode ==''CSS1Compat''



为什么需要检查?它是*你*写的文件类型将

决定模式,而不是时空连续体中的随机波动。


如果你'我不确定哪种模式会触发哪些模式,请看:


< http://hsivonen.iki.fi/doctype/>


sherm--


-

West Virginians的网页寄存,西弗吉尼亚人: http://wv-www.net

Perl中的Cocoa编程: http://camelbones.sourceforge.net


Is there any other way apart from:
document.compatMode == ''CSS1Compat''

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Virtual Library</title>
<script type="text/javascript">
<!--
function init(){
window.status=''You are in ''
+((document.compatMode==''CSS1Compat'')?''Standards'': ''Quirks'')+'' mode.''
}
window.onload=init;
//-->
</script>
</head>
<body>
<p>Howdy</p>
</body>
</html>

解决方案

Harry Haller wrote:

Is there any other way apart from:
document.compatMode == ''CSS1Compat''

Other way for what? Oh, the question was in the subject field:

Check whether browser is in quirks or standards mode?

No better ways come to mind, but using a bookmarklet would be handier:

http://dorward.me.uk/www/bookmarklets/qors/

Osmo


On 4 Apr, 08:30, Harry Haller <H...@Steppenwolf.comwrote:

Is there any other way apart from:
document.compatMode == ''CSS1Compat''

Just author the document so that it sets the browser into a Standards
mode. This list is obscure, but it''s deterministic. A browser doesn''t
flip between modes just because it''s Thursday.


Harry Haller <Ha***@Steppenwolf.comwrites:

Is there any other way apart from:
document.compatMode == ''CSS1Compat''

Why would you need to check? It''s the doctype that *you* wrote that will
determine the mode, not random fluctuations in the space-time continuum.

If you''re not sure which doctypes will trigger what modes, have a look at:

<http://hsivonen.iki.fi/doctype/>

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


这篇关于检查浏览器是否处于怪癖或标准模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆