How to get the html string exactly like IE renders it?
-
06-07-2021 - |
سؤال
I am having some problem to get the exactly same HTML string as rendered by IE10. There're some slight difference between the one rendered by IE 10, and the one I retrieved with WebClient.DownloadString(url). (see this question)
How to get the exactly same HTML string? Do I need to simulate the Browser behavior?
المحلول 2
This question is duplicated with this one: How to get the page source from an IE window?
And I have solved it there.
نصائح أخرى
Try adding the user-agent header for IE10 to your request:
WebClient client = new WebClient ();
client.Headers.Add ("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)");
Depending on your scenario (mobile, x64, etc.), the header might have different values. See IE10 User Agent String Update for other examples.
لا تنتمي إلى StackOverflow