简体   繁体   English

无法定位Internet Explorer

[英]Can't target Internet Explorer

I am trying to make it so that if the browser is Internet Explorer I want to show an iframe, but it isn't working, If I use IE it doesn't show and I can't figure out why. 我试图这样做,如果浏览器是Internet Explorer我想显示一个iframe,但它不工作,如果我使用IE它不显示,我无法弄清楚为什么。

Below is my code: 以下是我的代码:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Fastlane Autosales</title>
<link href="http://fonts.googleapis.com/css?family=Oswald:400,300" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>


<style>
 body {width:100%; height:100%; overflow:hidden, margin:0}
 html {width:100%; height:100%; overflow:hidden}
  #size {   width: 900px;   
        height: 700px; 
        display: block;}
</style>


 <body>

<!--[if IE]>


<div style="position: absolute; top: 110px; left: 20px;">
<iframe id = "size" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0"      style="background-color:#E6E6E6" src="http://listings2011.boostmotorgroup.com/Search.aspx?    DealershipID=4075&amp;isLogo=0&amp;MediaID=36"></iframe>
</div>

<![endif]-->

</body>
</html>

Browser detection is brittle and problematic at best. 浏览器检测很脆弱,最多也存在问题。 A cleaner approach would be to do feature detection (test for things you need and enable (or disable) features based on those features. Modernizer is a great way to do this. 更简洁的方法是进行功能检测(根据这些功能测试您需要的功能并启用(或禁用)功能.MODICizer是一种很好的方法。

According to Microsoft , "As of Internet Explorer 10, conditional comments are no longer supported by standards mode". 根据微软的说法 ,“从Internet Explorer 10开始,标准模式不再支持条件注释”。

I verified this by testing your code in IE. 我通过在IE中测试您的代码来验证这一点。 When I switched to browser modes 7-9, I was able to see the iframe, but not in IE 10 mode. 当我切换到浏览器模式7-9时,我能够看到iframe,但不能在IE 10模式下看到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM