简体   繁体   English

如何在Winform Web浏览器C#中将网站内容作为移动Web浏览器加载

[英]How to load content of website as mobile web browser in my winform web browser C#

I have made a web browser in C#, but i want an option like use as a mobile browser , like which contents of websites will load as mobile browser like if at that moment user browses www.facebook.com it will automatically go to m.facebook.com such as our mobile phone browsers does. 我已经用C#制作了一个网络浏览器,但是我想要一个像用作移动浏览器那样的选项,例如网站的内容将作为移动浏览器加载,就像此时用户浏览www.facebook.com一样 ,它将自动转到m。像我们的手机浏览器一样的facebook.com

I can make this by replacing www to m by String Changing but some other sites like blogspot sites has two different views for mobile and web in one domain of {myblog}.blogspot.com 我可以通过用字符串更改www替换为m来实现此目的,但是其他网站(例如blogspot网站)在{myblog} .blogspot.com的一个域中对于移动设备和网络有两种不同的视图

So for these cases, is it possible to load contents as mobile browser in my winform web browser {im using C#} 因此,在这些情况下, 是否可以将内容作为移动浏览器加载到我的winform Web浏览器中( {使用C#})

EDIT: I meant something like User Agent 编辑:我的意思是类似用户代理

Try this : 尝试这个 :

webBrowser.Navigate("http://localhost/run.php", null, null,
                string.Format("User-Agent: {0}", "Opera/9.80 (J2ME/MIDP; Opera Mini/9 (Compatible; MSIE:9.0; iPhone; BlackBerry9700; AppleWebKit/24.746; U; en) Presto/2.5.25 Version/10.54"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM