在 wp7 的 WebBrowser 控件中带回移动版本的网站? [英] Bring back mobile version of website in WebBrowser control for wp7?
问题描述
是否可以在显示网页的正常呈现之前以移动格式恢复网页(如果可用)?我注意到当我使用它时我得到了两者.还是默认启用?
Is it possible to bring back web pages in a mobile format, if available, before showing the normal rendering of a web page? I noticed I was getting both when I used it. Or is this enabled by default?
例如,在手机上的 ie 中,您可以请求接收移动版本或桌面版本的网页.开发人员是否可以使用此选项?如果不能,控件的默认设置是什么?
For example in ie on the phone you can request to recieve webpages in a mobile version or desktop version. Is this option available to developers and if not what is the default for the control?
推荐答案
遗憾的是,没有用于切换此设置的 API - 也没有简单的方法来拦截来自浏览器控件的传出 HTTP 调用.
Sadly, there's no API for toggling this setting - and no easy way to intercept the outgoing HTTP calls from the browser control.
查看模拟器的一些输出,它看起来像移动/完整设置在用户代理中切换:
Looking at some output from the emulator it looks like the mobile/full setting toggles this in the User-Agent:
手机 -Mozilla/4.0+(兼容;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
Mobile - Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
桌面 -Mozilla/4.0+(兼容;+MSIE+7.0;+Windows+NT+6.1;+XBLWP7;+ZuneWP7)
Desktop - Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+XBLWP7;+ZuneWP7)
这里还有一些在野外"捕获的移动代理 - http://www.elucidsoft.com/blog/2010/11/19/windows-phone-7-user-agents/
Here also are some mobile agents captured "in the wild" - http://www.elucidsoft.com/blog/2010/11/19/windows-phone-7-user-agents/
看起来这个设置是操作系统的全局设置 - 因此用户在浏览器设置中选择的任何内容也会在您的应用中使用(我想这就是我刚刚看到的).
It looks like this settings is a global setting for the OS - so whatever the user chooses in the browser settings is also used in your app (I think this is what I just saw).
这篇关于在 wp7 的 WebBrowser 控件中带回移动版本的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!