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

  • Home
  • SEARCH
  • 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 3423120
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:19:03+00:00 2026-05-18T06:19:03+00:00

On this page http://blog.zacharyvoase.com/2010/11/11/sockets-and-nodes-i/ , running the following code in javascript console will throw

  • 0

On this page http://blog.zacharyvoase.com/2010/11/11/sockets-and-nodes-i/, running the following code in javascript console will throw an Exception.

var div = document.createElement('div'); div.innerHTML = "»";
  • Chrome 8.0.552.28 Mac: Error: INVALID_STATE_ERR: DOM Exception 11
  • Firebug in Firefox 3.6.12 Mac: NS_ERROR_DOM_SYNTAX_ERR An invalid or illegal string was specified
  • Safari 5.0.2 Mac: Error: NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7
    Opera: works fine

But it works fine in all other pages I tried. My questions are what’s special about the page and why does chrome and firefox throw an exception?

Writing the character directly without using entity works fine.

var div = document.createElement('div'); div.innerHTML = "»";

Using other entities also works, e.g.

var div = document.createElement('div'); div.innerHTML = "<";
  • 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-18T06:19:04+00:00Added an answer on May 18, 2026 at 6:19 am

    I’m answering my own question.

    The short answer: it’s because of browser limitation.

    If a page is recognized as XHTML by certain browsers, only a subset of named character entities allowed by the standard are supported for innerHTML assignment.

    Specifically in my testing, it seems that in Mozilla and Webkit, only ", &, < and > are allowed in innerHTML assignment.

    My testing code is available here: https://gist.github.com/673901

    XHTML is a “better” and cleaner version of HTML reformulated in XML. XHTML 1.1 was supposed to be the successor and future of HTML. However, this is unlikely to happen with the adoption of HTML5.

    Unlike HTML, which requires a dedicated HTML parser, an XHTML document can be parsed by a general XML parser. At least in mozilla and webkit, XHTML and HTML go through different code paths. It’s understandable that the HTML code path is where most effort goes to and also better tested because there are far more HTML documents out there than XHTML.

    It is worth noting that whether a document is recognized as XHTML is determined by the effective MIME type rather than the document content.

    The conclusion is that if you are working with XHTML, make sure you convert named entities to numeric entities (e.g.   ->  ) before assigning to .innerHTML.

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

Sidebar

Related Questions

in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
I just followed the instructions from this page ( http://www.alexkorn.com/blog/2011/03/getting-php-mysql-running-amazon-ec2/ ) to setup apache
On this page: http://www.blackdownluxurylettings.co.uk/place_booking/2010-3-18,2 I am using an onchange event on the number of
Take a look at this page: http://pearl.tinderfields.com/ In IE6 the menu's background image loads
I am mostly following this page: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html I used this command to create the
My javascript paths work on this page: http://localhost:53049/ But not on this page: http://localhost:53049/Home/Messages
I am creating a dialog like in this page: http://jqueryui.com/demos/dialog/#modal-confirmation (click view source) on
This page: http://blog.ostermiller.org/convert-java-outputstream-inputstream describes how to create an InputStream from OutputStream: new ByteArrayInputStream(out.toByteArray()) Other
In chrome, on a mac, take a look at this page- http://www.davepoyzer.com/ (specifically the
I've been playing around with this page adding CSS3 styles and all. http://daokun.webs.com/jQuery/Progress.html The

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.