MSHTML IHTMLTxtRange.pasteHtml() and FEATURE_BROWSER_EMULATION=11001 = wrong html

If I enable emulation of IE11 for my application in registry here:
HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\myAppName.exe
and insert html into WinForms WebBrowser control using function IHTMLTxtRange.pasteHtml(), then text between html elements is interpreted probably wrong:
-spaces transformed to <p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
-line breaks between html elements transformed to <br/> tags.
As a result I get wrong html.
Test application:
Form1.cs:
public partial class Form1 : Form
        public Form1()
            //enable IE11 mode
            string fileName = System.IO.Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName);
            using (RegistryKey key = Registry.CurrentUser.CreateSubKey(
                @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION",
                RegistryKeyPermissionCheck.ReadWriteSubTree))
                key.SetValue(fileName, (UInt32)11001, RegistryValueKind.DWord);
            InitializeComponent();
        private void button1_Click(object sender, EventArgs e)
            //enable design mode
            webBrowser1.Navigate("about:blank");
            IHTMLDocument2 mshtmlDoc2 = webBrowser1.Document.DomDocument as IHTMLDocument2;
            mshtmlDoc2.designMode = "On";
            //insert html
            while (mshtmlDoc2.readyState != "complete")
                Application.DoEvents();
            mshtmlDoc2.body.innerHTML = "<p>paragraph 1</p>";
            IHTMLTxtRange bodyRange = (mshtmlDoc2.body as IHTMLBodyElement).createTextRange();
            bodyRange.collapse(Start: false);
            bodyRange.pasteHTML("<p>paragraph 2</p>\n\n\n        <p>paragraph 3</p>");
            //show result html
            textBox1.Text = webBrowser1.DocumentText;
Form1.designer.cs:
partial class Form1
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
            if (disposing && (components != null))
                components.Dispose();
            base.Dispose(disposing);
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.button1 = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            // webBrowser1
            this.webBrowser1.Location = new System.Drawing.Point(12, 12);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(626, 190);
            this.webBrowser1.TabIndex = 0;
            // button1
            this.button1.Location = new System.Drawing.Point(12, 338);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(143, 23);
            this.button1.TabIndex = 1;
            this.button1.Text = "Insert html";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // textBox1
            this.textBox1.Location = new System.Drawing.Point(12, 208);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(626, 124);
            this.textBox1.TabIndex = 2;
            // Form1
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(652, 373);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.webBrowser1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();
        #endregion
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox textBox1;
As a result I get the following html which, I think, is wrong:
<P>paragraph 1</P>
<P>paragraph 2</P>
<P><BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>paragraph 3</P>

Hi,
remove the exogenous whitespace from your markup strings. IE10 and later support textnodes.
is whitespace (space+NL)
"&nbsp;<br/>" is the markup equivalent
<elm>
 <span>content<span>
</elm>
document.queryselector('elm').firstChild.nodeName
#textnode
is not the same as
<elm><span>content</span></elm>
document.queryselector('elm').firstChild.nodeName
SPAN
In the Developer tool of webkit browsers you can turn on whitespace formatter to display the control characters (white space) that is in the source markup.
Make sure your web pages contain a utf-8 content-type meta
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
Rob^_^

Similar Messages

  • I just synced with my MBP, but my iCloud account email address remains in a "inactive" status. Under settings the Apple ID and Password is wrong, and I can't find out how to fix it

    I just switched over to an iPhone 4 CDMA on the verizon network the other day. I connected with my MBP/ w Lion and the sync seemed to go flawless.... All my date was pushed thru the iCloud, but then I saw that my main email address @me.com says that it is inactive when I look at it in Settings- Mail-Accounts. I can see that the iCloud account name and password is wrong, but I can not seem to find out how to correct it. Can anyone help me?
    Thanks a lot,
    Fred

    You either have an incredibly complex computer setup or I think you are confusing terminology here.  If you have iTunes set to share your library with others in your iTunes preferences then other computers in the area will see it as an item when they are running their iTunes and have it set to check for shared libraries.  Your husband is probably seeing this when running iTunes on his computer.  You can disable this sharing on your computer and/or he can set his not to pick up shared libraries.
    By the way, an iTunes account is something you log into when you want to buy something from Apple.  On your computer it is simply your iTunes collection or your iTunes application.  So you need to turn off sharing in your iTunes application preferences.
    Your husband is seeing "his" iTunes collection when running iTunes, but it is possible he doesn't have anything in it if it is a brand new computer.

  • I am trying to install flash player on my new Macpro hardrive.  It is downloaded but I get the continual message that my I.D. and password are wrong. Help please!

    I am trying to install my downloaded flash player on my new MacPro hard drive.  I get the continual message that my I.D. and password are wrong.  I know they are not wrong and have tried a lot of combinations from old Macs and old passwords too.  Nothing works.  How can I get the job done?

    Hi,
    On Mac, this password prompt is presented by your operating system, and is intended to keep you from accidentally installing software which can harm your system. Flash Player does not throw this prompt, Apple does that.
    Please provide machine credentials of currently logged in User to continue with the installation.
    Hope this helps.
    Thanks
    Piyush

  • I am in the process of expanding a database of chemistry journal articles.  These materials are ideally acquired in two formats when both are available-- PDF and HTML.  To oversimplify, PDFs are for the user to read, and derivatives of the HTML versions a

    I am in the process of expanding a database of chemistry journal articles.  These materials are ideally acquired in two formats when both are available-- PDF and HTML.  To oversimplify, PDFs are for the user to read, and derivatives of the HTML versions are for the computer to read.  Both formats are, of course, readily recognized and indexed by Spotlight.  Journal articles have two essential components with regards to a database:  the topical content of the article itself, and the cited references to other scientific literature.  While a PDF merely lists these references, the HTML version has, in addition, links to the cited items.  Each link URL contains the digital object identifier (doi) for the item it points to. A doi is a unique string that points to one and only one object, and can be quite useful if rendered in a manner that enables indexing by Spotlight.  Embedded URL's are, of course, ignored by Spotlight.  As a result, HTML-formatted articles must be processed so that URL's are openly displayed as readable text before Spotlight will recognize them.  Conversion to DOC format using MS Word, followed by conversion to RTF using Text Edit accomplishes this, but is quite labor intensive.
      In the last few months, I have added about 3,500 articles to this collection, which means that any procedure for rendering URL's must be automated and able to process large batches of documents with minimal user oversight.  This procedure needs to generate a separate file for each HTML document processed. Trials using Automator's "Get Specified Finder Items" and "Get Selected Finder Items", as well as "Ask For Finder Items"  (along with "Get URLs From Web Pages") give unsatisfactory results.  When provided with multiple input documents, these three commands generate output in which the URLs from multiple input items are merged into a single block, which yields a single file using "Create New Word Document" as the subsequent step.  A one-to-one, input file to output file result can be obtained by processing one file at a time, but this requires manual selection of each item and one-at-a-time processing. What I need is a command that accepts multiple input documents, but processes them one at a time, generating a separate output for each file processed.  Is there a way for Automator to do this?

    Hi,
    With the project all done, i'm preparing for the presentation. Managed to get my hands on a HD beamer for the night (Epason TW2000) and planning to do the presentation in HD.
    That of course managed to bring up some problems. I posted a thread which i'll repost here . Sorry for the repost, i normally do not intend to do this, but since this thread is actually about the same thing, i'd like to ask the same question to you. The end version is in AfterEffects, but that actually doesn't alter the question. It's about export:
    "I want to export my AE project of approx 30 min containing several HD files to a Blu Ray disc. The end goal is to project the video in HD quality using the Epson  EMP-TW2000 projector. This projector is HD compatible.
    To project the video I need to connect the beamer to a computer capable of playing a heavy HD file (1), OR burn the project to a BRD (2) and play it using a BRplayer.
    I prefer option 2, so my question is: which would be the preferred export preset?
    Project specs:
                        - 1920x1080 sq pix  (16:9)
                        - 25 fps
                        - my imported video files (Prem.Pro sequences) are also 25 fps and are Progressive (!)
    To export to a BRD compatible format, do i not encounter a big problem: my projectfiles are 25 fps and progressive, and I believe that the only Bluray preset dispaying 1920x1080 with 25 fps requests an INTERLACED video  (I viewed the presets found on this forum, this thread)... There is also a Progr. format, BUT then you need 30 fps (29,...).
    So, is there one dimension that can be changed without changing the content of the video, and if yes which one (either the interlacing or the fps).
    I'm not very familiar with the whole Blu-ray thing, I hope that someone can help me out."
    Please give it a look.
    Thanks,
    Jef

  • Report and data comming wrong after compress data with full optimization

    In SAP BPC 5.1 version to increase the sysetm performance we did full optimization with compress data.
    Theis process end with error, after login into system the report and values comming wrong,
    What is the wrong,how to rectify it
    Regards
    prakash J

    This issue is resolved,

  • Last night as I was setting up the pin I got distracted and entered the wrong one, now I can't access my phone as I don't know what I entered. Is there anyway around this or do I have to wipe my phone and sign in with my Apple ID and restore from icloud??

    Last night as I was setting up the pin I got distracted and entered the wrong one, now I can't access my phone as I don't know what I entered. Is there anyway around this or do I have to wipe my phone and sign in with my Apple ID and restore from icloud??
    I can't ask for help on chat as I'm away from home and don't have the box with me, and obviously can't get the serial number in my phone as I've locked myself out!!
    Any help will be much appreciated!!

    https://support.apple.com/kb/ht1212

  • I went to create a itunes account and entered the wrong e-mail in and my ITunes confirmation code was sent to that e-mail. The person who recieved the e-mail shouldnt be able to keep it due to they dont know the password i made for the account correct?

    I went to set up an ITunes account and entered the WRONG e-mail. After everything was complete it sent the Itunes conformation number to the wrong e-mail. I dont believe they can use it because they dont know the password it will ask them for that e-mail for the account. How do i redeem the itunes back? When i enetr the code to try and use it for my correct e-mail it says it already has been redeemed.

    Go to https://expresslane.apple.com ; select 'iTunes' in the first column; 'iTunes Store' in the second column then see if there is an appropriate place to report the problem.

  • Problem in opening 'Find Service Request' and 'Create Service Request' HTML forms

    Hi,
    I  am working on creating some date for EBS Service, and I am unable to open 'Find Service Request' and 'Create Service Request' HTML forms.
    I keep getting the error message :
    Oracle error - 20001: ORA-20001: APP-FND-02902: Multi-Org profile option is required. Please set either MO: Security Profile or MO: Operating Unit profile option. has been detected in MO_GLOBAL_INIT.
    I have min knowledge of EBS set up and configuration. We just use EBS as a source system for our ETLs.  Please suggest any workaround to get resolve the issue.
    Thanks,
    Kishore

    Navigate to System Administrator responsibility > Profile > System. Search for the profile MO: Operating Unit and under responsibility field, put in the responsibility name you are using for creating the service request, click OK and enter the desired operating unit value in the next window. It pulls up all operating units defined and you can chose the desired one.
    Thanks
    Shree

  • We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter

    We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter who on our network opens the design file.

    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Imported images and processed in wrong project can I transfer?

    imported images and processed in wrong project can I transfer to the correct project and delete from the incorrect project without loosing my work so far?
    ok I know similar questions have been asked but I could not find an answer using search.....so any ideas... all help is really appreciated.
    (In aperture 2)

    Sorry I er 'cough' have just dragged and dropped from one project to another, and er well you see er that seems to have done it!images removed from first project and now appear in second correct project.
    I am sure I tried that before I posted..

  • Can I design something in Muse and somehow get the HTML text fro it to plug into Business Catalyst to make a newsletter?

    I guess since I don't know html, I was wondering if I could create a "page" in muse and somehow get the "HTML" text from it so I can plug that text into a Business Catalyst E-Mail Marketing Campaign template. since I am struggling so much with modifying one of Business Catalysts established templates.
    I made my website with muse and I host it through Business Catalyst with a webMarketing Plan.
    Thanks in advance,

    There is no direct way to achieve this but you may try a workaround which may work but would require testing on your end.
    Create the site in Muse and publish to BC , master page will be included in template section. So in your published site , Page template will show you design from Muse.
    Now from Partner portal , you can select the site to create email campaign template but please note that creating a template from PP will remove the default email campaign templates on BC end.
    After creating the campaign template from PP , login to your site and create email campaign and in template section you will get the option to select the template which you created from PP.
    Not an ideal way but can be used as a workaround.
    Thanks,
    Sanjit

  • Why Reports format behaves different in Excel and browser(if desformat=html or pdf)?

    1-Why Reports format behaves different in Excel and browser(if desformat=html or pdf)?
    2-I made three queries Q1,Q2 & Q3 and linked them with proper field links but suppose Q3 returns no records for some Q1&Q2 records & when the report runs for delimited options it reflects only those records as output for which all the queries return records(if Q3 returns no record then the related records from queries Q1,Q2 don't reflect) while the output in desformat=html or pdf is ok..
    can you please resolve my problems
    ( I have installed patch 5a in my report server machine)
    Thanks & Regds.
    Suneel
    null

    What do you mean by "different"? (In our
    experience, Oracle html output has too many
    columns, which are not visible in the
    browser but are obvious in Excel.)
    We build our own html programmatically, so
    that Excel matches the browser more closely.
    -- Allan Plumb

  • HT1420 I can't use the new I pad on I store its asking for job questions which I don't no the answer I put the right answer and its sayin wrong

    I bought a new I pad I want to download some movies I am going away tonight and its asking for job security questions at which I put the answers and it says wrong I can't remember what I put years ago what do I do I just bought a $100 I tunes card

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then see if the instructions on this user tip helps you get them reset : https://discussions.apple.com/docs/DOC-4551

  • Can I turn off CSS in DW CS4 and use good ole HTML tags?

    Can I turn off CSS in DW4 and use good ole HTML tags?
    I can in DW CS3 but can't see how to in CS4.
    Thanks.

    Having just been though a similar issue as described in another thread, I thought you might find this useful:
    http://forums.adobe.com/thread/522805?tstart=0

  • Date and time are wrong

    My date and time are wrong on boot up and won't adjust back to normal automatically.  I think the internet is telling me it's a problem with either my PRAM or CMOS or NVRAM battery, the little guy that holds info while the big guy is tapped.  I want to replace this. Is that possible?  What is the battery actually called?

    Hey MisterW,
    Thanks for the question. It sounds like you wish to reset your PRAM/NVRAM, the following article should assist you:
    About NVRAM and PRAM
    http://support.apple.com/kb/HT1379
    Thanks,
    Matt M.

Maybe you are looking for