Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Anchors and frames and mshtml.document

Hi people,

well I got a nice mshtml.htmldocument object in my hand, and I want to use the anchors property of the object which is really concise and nice.

when i use an url like google.com, it works fine, I can see all the anchors up to their tiniest details. But when I go to a site like msdn.microsoft.com, the anchors property comes empty

I'm guessing that this happens because the page has frames. Do I have to iterate through all the frames in the document ? If so, how ?

PS. TheLearnedOne, I'm not using webbrowser control ;)

Best regards.
  • 2
1 Solution
Bob LearnedCommented:
If you look at the header of the source document, you will notice that the MSDN site uses XHTML:

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-us"><head id="ctl00_Head1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="ms.locale" content="en-us" />

That is a totally different proposition.

wildcard76Author Commented:
so I gather, frames or not, the anchor property should be givin us all the link elements, and when it comes to xhtml, what should be the correct approach to this one then?

Bob LearnedCommented:
I haven't worked with XHTML, so I don't know the best approach here.  I do know enough to know that the structure is distinctly different enough for the code that I showed you not to work.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now