开发者

Render html5 page in IE with javascript disabled [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current for开发者_Go百科m. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

can any anyone suggest how to Render html5 page in IE with javascript disbaled?


Assuming that you're talking about the HTML5 semantic elements..

There is no real solution. This is a good discussion of the possible workarounds:

http://debeterevormgever.nl/en/articles/html5-elements-ie-without-javascript


What version of IE are you referring to?

The current version, IE9, supports HTML5 just fine, out of the box.

But I suspect you're referring to IE8 or below, and the Javascript-based html5shiv hack?

If that's what you mean, then the answer is 'no'. Sorry about that. IE8 and earlier do not support the HTML5 elements, and they do not work correctly if HTML contains unknown elements; this means that they effectively do not support HTML5.

The html5shiv hack (and the similar code in Modernizr) work because IE has a 'feature' whereby if an element is created in the DOM using Javascript, then subsequently the browser will recognise that element type. This allows these hacks to create a bunch of elements for the HTML5 tags using Javascript, and for IE then to be able to use those tags in a page.

This is only possible due to this feature in the way IE works with Javascript. It is not possible to achieve it without Javascript.

It's also worth pointing out that even with this hack, IE8 does not support HTML5. HTML5 consists of a lot more than just a few new element tags, and none of that other extra functionality is supported, regardless of whether you run html5shiv or not.

For all those other modern browser features which are not present in older versions of IE, there are a wide variety of hacks to add the functionality. You can see a reasonably complete list of them here: https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills

But as you probably already know, virtually all of them require Javascript.

But I guess the real problem with your question is that a modern website, written using HTML5, is almost certain to use Javascript itself. Some HTML5 features (such as Canvas) are virtually pointless without having some Javascript code to manipulate them. So in truth, it's not just IE that's going to struggle to work with Javascript turned off on a modern HTML5-based site; pretty much any browser is going to have issues.


HTML5 is markup. It has strictly nothing to do with javascript. So if you design your HTML5 page in such a way that it doesn't require javascript, well, it will run fine on IE (at least on latest versions which support HTML5). And by the way that's true not only for IE but for any browser. Here's an example of an HTML5 document:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>HTML5 demo</title>
</head>

<body>
    <div>Hello World</div>
</body>
</html>

Of course depending on the version of IE you are using and the different HTML markup elements, some might render properly if supported while others might not.


If I need IE compatible HTML5, one of the standard techniques is to, instead of <section> or <article> tags, use divs with classes like this:

<div class="article">
  <div class="section">
    Section Text here.
  </div>
</div>

This is perfectly valid HTML5, and if you fed it into a validator (along with all the standard stuff such as <html>, <head>, and <body>) it would pass. The only problem is that it's not semantically valid, which is probably what is important to you.

If you want the best of both worlds, and you're using something like PHP, ASP.NET or similar to deliver your content from the server, you could try some user agent sniffing, and if the UA is IE (or looks like it is), then send the non-semantic markup shown above, otherwise, just send normal HTML5 standard semantic tags. The question is whether or not it's worth the effort (and ambiguity) of parsing UA strings simply to deliver semantic markup.

Other than that, as far as I'm aware there is no way of getting IE to recognise HTML5 semantic elements without JavaScript.


http://code.google.com/chrome/chromeframe/

Probably not the answer you are looking for, but may suit your purposes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜