当前位置: 动力学知识库 > 问答 > 编程问答 >

html5 - Microsoft.Phone.Controls.WebBrowser as a desktop browser

问题描述:

I develop an Windows Phone 8 application that shows html5 content in Microsoft.Phone.Controls.WebBrowser.

Is there a way to make the WebBrowser control interpret the HTML content as a normal desktop web browser?

网友答案:

At least with the initial navigation, you can specify additional headers to be sent, including the User-Agent:

var ua = "User-Agent: MyDesktopAgent";
// IE10 desktop: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
// IE11 desktop: Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
webBrowser.Navigate("http://www.stackoverflow.com", null, ua);

Beyond that, there's not much you can do other than wait for web sites to move to a more responsive design that adapts to screen size and capabilities rather than looking at browser User-Agent strings.

分享给朋友:
您可能感兴趣的文章:
随机阅读: