1

hi guys im creating a metro app for my lumia 930 (windows 8.1) that it has a webview . Questions : 1. how to change webview agent, i mean how to show desktop version of website? 2. how to allow download and upload in webview?

TNX

user3475113
  • 77
  • 3
  • 14

1 Answers1

0

ok i just found something that works and answered the first question.

add this to your header

using System.Runtime.InteropServices;

and add this to your class

[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);
    }

and add this before navigating to url

ChangeUserAgent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0");

now its done . but the second question remains :|

sources: Change user agent in WP8.1 WebView and
Want to load desktop version in my webview using uastring

Community
  • 1
  • 1
user3475113
  • 77
  • 3
  • 14