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 6336473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:03:50+00:00 2026-05-24T19:03:50+00:00

For some reason when I try writing to an HtmlDocument it strips some (not

  • 0

For some reason when I try writing to an HtmlDocument it strips some (not all) of the quotation marks of the string I am giving it.

Look here:

HtmlDocument htmlDoc = Webbrowser1.Document.OpenNew(true);
htmlDoc.Write("<HTML><BODY><DIV ID=\"TEST\"></DIV></BODY></HTML>");
string temp = htmlDoc.GetElementsByTagName("HTML")[0].InnerHtml;

The result of temp is this:

<HEAD></HEAD>
<BODY>
<DIV id=TEST></DIV></BODY>

It works exactly as it should except it is stripping the quotation marks. Does anyone have a solution on how to prevent or fix this?

  • 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-24T19:03:51+00:00Added an answer on May 24, 2026 at 7:03 pm

    There is no guarantees with innerHTML that it will return content identical to string you passed in. The innerHTML is constructed by browser using its HTML tree representation – so it will produce resulting string as it see fits.

    So depending on your needs you can try to use some HTML parsing code that understands ID’s without quotes around OR try to convince browser to use latest engine which more likely to produce innerHTML to you liking.

    I.e. in your case it looks like at least IE9 renders your HTML as IE9:Quirks mode (that returns innerHTML in the shape your are not happy with), if you make valid HTML or force mode to IE9:Standard you’ll get string with qoutes like

    document.getElementsByTagName("html")[0].innerHTML 
    

    IE9:Standards – "<head></head><body><div id="TEST"></div></body>"

    IE9:Quirks –

    "<HEAD></HEAD>
    <BODY>
    <DIV id=TEST></DIV></BODY>" 
    

    You can try it yourself by creating sample HTML file and opening from disk. F12 to show dev tools and check out mode in the menu bar.

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

Sidebar

Related Questions

For some reason if I try to get the actual size of mystruct I
I'm getting undefined for some reason when I try to return the html via
For some reason every time I try to count the number of rows in
For some reason, when I try to install SQL Server 2008 Express , I
For some reason, when I try to animate textColor , it won't work. The
For some reason I never see this done. Is there a reason why not?
For some reason, Section 1 works but Section 2 does not. When run in
So I'm writing an app, and for some reason I get a Runtime exception
for some reason whenever i try to spawn a server with rubber it gets
Hey im writing an echo client, and for some reason the connectsock function is

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.