Difference between IE 10 rendered HTML and its out

2019-06-08 20:56发布

I use IE 10 F12 button to locate a < a > node on my page, I got this:

<a tabindex="-1" class="level1 static" href="About.aspx">About</a>

But I use the following code to retrieve the page HTML, and get this:

<a class="level1" href="About.aspx">About</a>

Code:

        WebClient wc = new WebClient();
        String pageString = wc.DownloadString(url);

Why are they different?

Update:

Below is the Fiddler monitor result.

IE10:

enter image description here

enter image description here

WebClient:

enter image description here

enter image description here

2条回答
狗以群分
2楼-- · 2019-06-08 21:28

This question is duplicated with this one: How to get the page source from an IE window?

And I have solved it there.

查看更多
贪生不怕死
3楼-- · 2019-06-08 21:37

It's typical for webservers to send different output depending on which browser the request is coming from. Perhaps this "simplified" <a> tag is a result of that?

I'm not sure how WebClient works but perhaps it's possible to modify headers so you can act like you're an IE10 browser and see if the results are different.

查看更多
登录 后发表回答