c# Get innerHtml of an iFrame (using native .net framework)











up vote
0
down vote

favorite












using SHDocVw;


If I set up an internet explorer object and navigate to a page, I can get the innerhtml of the document like so:



mshtml.HTMLDocument htmlDoc = IE.Document;
string s = htmlDoc.body.innerHTML;


But this HTML is always missing the contents of the various iframes contained within it (even though I can see these in the DOM explorer in F12 dev).



How can I get iframe content?



I've tried:



1) This java attempt here but not sure how to replicate that in c#



2) getting the parent window properties e.g. htmlDoc.parentWindow.frames but not sure how to isolate frames



3) Banging my head against the keyboard



4) Also not able to use HTMLAgilityPacks or external libraries since this needs distributed widely and we're not sure of the implications of using these "external" libraries



Most answers seem related to js but there's usually a tonne of answers related to IE traversing on c#










share|improve this question
























  • Are those iframes maybe populated with an xhr call (json)? Do you have the url?
    – Ole EH Dufour
    yesterday

















up vote
0
down vote

favorite












using SHDocVw;


If I set up an internet explorer object and navigate to a page, I can get the innerhtml of the document like so:



mshtml.HTMLDocument htmlDoc = IE.Document;
string s = htmlDoc.body.innerHTML;


But this HTML is always missing the contents of the various iframes contained within it (even though I can see these in the DOM explorer in F12 dev).



How can I get iframe content?



I've tried:



1) This java attempt here but not sure how to replicate that in c#



2) getting the parent window properties e.g. htmlDoc.parentWindow.frames but not sure how to isolate frames



3) Banging my head against the keyboard



4) Also not able to use HTMLAgilityPacks or external libraries since this needs distributed widely and we're not sure of the implications of using these "external" libraries



Most answers seem related to js but there's usually a tonne of answers related to IE traversing on c#










share|improve this question
























  • Are those iframes maybe populated with an xhr call (json)? Do you have the url?
    – Ole EH Dufour
    yesterday















up vote
0
down vote

favorite









up vote
0
down vote

favorite











using SHDocVw;


If I set up an internet explorer object and navigate to a page, I can get the innerhtml of the document like so:



mshtml.HTMLDocument htmlDoc = IE.Document;
string s = htmlDoc.body.innerHTML;


But this HTML is always missing the contents of the various iframes contained within it (even though I can see these in the DOM explorer in F12 dev).



How can I get iframe content?



I've tried:



1) This java attempt here but not sure how to replicate that in c#



2) getting the parent window properties e.g. htmlDoc.parentWindow.frames but not sure how to isolate frames



3) Banging my head against the keyboard



4) Also not able to use HTMLAgilityPacks or external libraries since this needs distributed widely and we're not sure of the implications of using these "external" libraries



Most answers seem related to js but there's usually a tonne of answers related to IE traversing on c#










share|improve this question















using SHDocVw;


If I set up an internet explorer object and navigate to a page, I can get the innerhtml of the document like so:



mshtml.HTMLDocument htmlDoc = IE.Document;
string s = htmlDoc.body.innerHTML;


But this HTML is always missing the contents of the various iframes contained within it (even though I can see these in the DOM explorer in F12 dev).



How can I get iframe content?



I've tried:



1) This java attempt here but not sure how to replicate that in c#



2) getting the parent window properties e.g. htmlDoc.parentWindow.frames but not sure how to isolate frames



3) Banging my head against the keyboard



4) Also not able to use HTMLAgilityPacks or external libraries since this needs distributed widely and we're not sure of the implications of using these "external" libraries



Most answers seem related to js but there's usually a tonne of answers related to IE traversing on c#







c# html iframe






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 13:45

























asked Nov 19 at 13:23









jamheadart

1,3282725




1,3282725












  • Are those iframes maybe populated with an xhr call (json)? Do you have the url?
    – Ole EH Dufour
    yesterday




















  • Are those iframes maybe populated with an xhr call (json)? Do you have the url?
    – Ole EH Dufour
    yesterday


















Are those iframes maybe populated with an xhr call (json)? Do you have the url?
– Ole EH Dufour
yesterday






Are those iframes maybe populated with an xhr call (json)? Do you have the url?
– Ole EH Dufour
yesterday



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375592%2fc-sharp-get-innerhtml-of-an-iframe-using-native-net-framework%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375592%2fc-sharp-get-innerhtml-of-an-iframe-using-native-net-framework%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen