Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6643747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:05:12+00:00 2026-05-26T00:05:12+00:00

We have a 3rd party web application which works on in IE6, but not

  • 0

We have a 3rd party web application which works on in IE6, but not works in IE8.

The sample code is like below, the “message from .htc” message will popup in IE6, but not popup in IE8.

test.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript'>
    //if comment the following line, or move this script in <body>,
    //then HTC will work in IE8
    document.write ("<h1>document.write() in &lt;head&gt;</h1> some calendar codes");
</script>
</head>

<body style='behavior:url(test.htc)'>
HTML Components test
</body>
</html>

test.htc

<script type='text/javascript'>
alert ("message from .htc");
</script>

Why this happened? Any compatible documents to explain this?


Solution

As @Quentin said or another expert from http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/c1f546f6-d7e1-4b46-a1c9-8f02eaf1286b said, IE8 probably make rules strictly compared to IE6, and IE8 may treat it as an corrupt HTML document.

So, I decide to to use document.createElement to create elements dynamically instead of document.write, and insert these elements to DOM after some seconds delay. After some tests, it finally worked both in this test.html and real application.

test-ie8-compatible.html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript'>
function Delay_CreateCalendar()
{
    var oContainer = document.createElement ("div");
    var oCalendarIFrame = document.createElement ("iframe");
    oContainer.appendChild (oCalendarIFrame);
    document.body.insertBefore (oContainer);
}
setTimeout (Delay_CreateCalendar, 2000);
</script>
</head>

<body style='behavior:url(test.htc)'>
dhtml HTC 测试
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:05:12+00:00Added an answer on May 26, 2026 at 12:05 am

    Presumably, despite the namespace, you are serving the document as text/html. In HTML the start and end tags for the head and body element are optional. H1 elements are not allowed inside the head.

    Thus, when you document.write and H1 inside the end, you trigger the end of the head and the start of the body.

    I assume that IE then ignores the start tag for the body element as it would create a second body (which also isn’t allowed).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a web based application which strictly relies on a 3rd party
I have a web application project which utilises a set of 3rd party dll's.
I have a 3rd party client/server application, not developed by me, who needs to
I have a Rails application that queries a 3rd party web service. I am
We have a web application where users often export files from a 3rd party
I have a 3rd party web page screen capture DLL from http://websitesscreenshot.com/ that lets
I have two WCF clients consuming a 3rd party web service. These two clients
I have a deal with a 3rd party web page. And If I click
I have 3rd party libraries for my mac applications which used to link nicely
After a payment from my web application to a 3rd party the 3rd party

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.