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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:26:23+00:00 2026-05-11T02:26:23+00:00

When programming in C++ against the browser’s DOM each engine has a different set

  • 0

When programming in C++ against the browser’s DOM each engine has a different set of interfaces, IE has the COM based [MSHTML](http://msdn.microsoft.com/en-us/library/aa752279(VS.85).aspx), Mozilla has the XPCOM based Gecko DOM etc.

Is there a common API that has adapters for major browsers (and versions)?


As a clarification, the application in question is a desktop application written in C++ which interacts with browsers, currently we have separate code bases for support of IE and Mozilla and I’m trying to reduce duplications of logic and allow adding new browsers with less effort.

A concrete example can be getting the innerHTML property of an HTML element.

// Firefox nsAutoString html; nsCOMPtr<nsIDOMNSHTMLElement> elem = do_QueryInterface(obj); if (elem)     elem->GetInnerHTML(html);   // IE CComBSTR html; MSHTML::IHTMLElementPtr elem = obj; if (elem)       elem->get_innerHTML(&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. 2026-05-11T02:26:24+00:00Added an answer on May 11, 2026 at 2:26 am

    Your best bet seems to be to define your own interface and write different adapters. In the likeliness that your C++ code won’t be employing all DOM traversing capabilities, your interface will only have to define a compact set of traversal functions.

    As a bonus of defining your own interface, you can easily write a mock adapter for your unit testing.

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I personally prefer QT as I prefer working with the… May 11, 2026 at 11:41 am
  • added an answer :%s/<?//ng See :h count-items. May 11, 2026 at 11:41 am
  • added an answer The reason it was failing was because I was comparing… May 11, 2026 at 11:41 am

Related Questions

When programming in C++ against the browser's DOM each engine has a different set
When programming in C++ in Visual Studio 2008, why is there no functionality like
I've been programming in Ruby for a few months now, and I'm wondering when
I am taking my first steps programming in Lua and get this error when
When I first started programming, I wrote everything in main. But as I learned,
When are objects or something else said to be "first-class" in a given programming
When programming by contract a function or method first checks whether its preconditions are
When programming C++ we used to create copy constructors when needed (or so we
When programming interfaces, I've found I'm doing a lot of casting or object type
this is a question that when programming I always wonder: What to use when

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.