0

我有以下 html 代码在 IE8 中没有 http-equiv="X-UA-Compatible" 的情况下工作,但是当它有它时会失败。我认为顺序是正确的(http://blogs.msdn.com/b/ieinternals/archive/2011/07/18/optimal-html-head-ordering-to-avoid-parser-restarts-redownloads-and-improve -performance.aspx),并且代码是有效的,所以我看不出它这样做的原因。

请问,有什么解释吗?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8, IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="file:///D:/LocalPath/ToFrameElements/">
<title>IE8 stuff</title>
</head>
4

3 回答 3

0

您的X-UA-Compatiblehttp-equiv 字符串无效。

它有 2 个值:

  1. IE=8(IE 8标准渲染模式)
  2. IE=edge(最新引擎)

但是,语法不正确。正确的语法是:

<meta http-equiv="X-UA-Compatible" content="IE=8; IE=edge" />

当指定多个值时,将使用最高值。那是,

  • In IE9 , the page will be rendered in IE 9 standards rendering mode.

  • In IE8 , the page will be rendered in IE 8 standards rendering mode.

Solution: Fix the syntax and retry.

Reference:

  1. https://developer.mozilla.org/en-US/docs/Persona/Browser_compatibility
  2. Define Document Compatibility
  3. Understanding Compatibility Modes in IE8

Sidenote: IE supports this meta tag starting from IE 8.

于 2013-02-28T07:40:57.110 回答
0

The base element is defined so that its value must be an absolute URL. Besides, any effect of a file: URL is by definition system-dependent. So you should organize your local files and references to them so that a base tag is not needed.

于 2013-02-28T09:24:43.807 回答
0

The frames wouldn't appear because of the standard document mode that the

<meta http-equiv="X-UA-Compatible" content="IE=8, IE=edge" />

or not relaying on the browser's error tolerance, the syntactically correct way

<meta http-equiv="X-UA-Compatible" content="IE=8; IE=edge" />

implies.

This is because in the standard document rendering mode IE does not allow the use of base href with links to the filesystem for security's sake. To have the base href working it can only be achieved by removing the the meta http-equiv="X-UA-Compatible" so that page will run in quirks rendering mode.

于 2013-03-01T07:04:24.347 回答