这适用于Windows Phone。我使用的是windowsphone8.1更新1.您知道Web界面的工作方式与Android和iOS相同。如何在我的wp8.1网络应用程序中获得相同的界面?我下载并安装了WP8.1 Update 1 SDK。当我打开一个新项目时,我没有看到Wp8.1更新1版本。我可以在WP8.1或Cyan更新用户中获得更新的Web界面吗?
答案 0 :(得分:2)
Windows Phone 8.1 Update 1不会为开发人员引入任何新的公共API。
如果您正在使用Windows Phone 8.1 XAML项目中的WebView
(又称WebBrowser
)控件,并且您想为整个会话指定其他用户代理,请使用...
[DllImport("urlmon.dll", CharSet = CharSet.Ansi)]
private static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved);
const int URLMON_OPTION_USERAGENT = 0x10000001;
public void ChangeUserAgent(string Agent)
{
UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, Agent, Agent.Length, 0);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
ChangeUserAgent("My Custom User-Agent");
wb.Navigate(new Uri("http://basquang.wordpress.com/2014/04/26/wp8-1-changing-windows-phone-8-1-webview-default-user-agent-in-all-outbound-http-requests/", UriKind.Absolute));
}