×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Angry Changing the phone:WebBrowser control useragent programatically

    Hi All,

    Is there a way to change my WebBrowser user agent when I am using the phone:WebBrowser control. ??

    In my code Before navigating to any page I want to overwrite my Default user agent ..

    webBrowserControl.IsScriptEnabled = true;
    webBrowserControl.IsGeolocationEnabled = true;
    // Need to set the diffrent User agent other than the default one
    webBrowserControl.Navigate(new Uri("http://abc.com"));


    Please let me know if any one has any solution .

    Thanks

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: Changing the phone:WebBrowser control useragent programatically

    Hello,
    Try this :
    this.webBrowser.Navigate(new Uri("http://whatsmyuseragent.com/",UriKind.Absolute), null, "User-Agent: your user agent");
    Hope this Helps,

    Charaf

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Changing the phone:WebBrowser control useragent programatically

    Hi Charaf,

    Thanks for your quick response . The solution what you have given is worked , but I have still one more problem , The useragent what I am setting it is working for the home page , for the subsequent links it is taking the phones default user agent , it is not considering the user agent what I have set , How to I make sure that the user agent will be same for all the links.

  4. #4
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: Changing the phone:WebBrowser control useragent programatically

    Hi,
    I don't think it will be possible to do what you want this way, yes this works only for the page you navigate to programmatically, for the other pages you'll get IEs user agent (which's logic)

  5. #5
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Changing the phone:WebBrowser control useragent programatically

    In android you have a control like open all the links with in the same webView .. Is there a some thing like that ?? Can I override the WebBrowser and get the links and open though the code ??

  6. #6
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    Re: Changing the phone:WebBrowser control useragent programatically

    I did it for my app Agent Browser. You have to add a new callback to the Navigating event of your WebBrowser and inside it check if it is the first call of the function; if yes, tell the WebBrowser to Navigate again to the same URI but with your custom user-agent specified.

  7. #7
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: Changing the phone:WebBrowser control useragent programatically

    Quote Originally Posted by r2d2rigo View Post
    I did it for my app Agent Browser. You have to add a new callback to the Navigating event of your WebBrowser and inside it check if it is the first call of the function; if yes, tell the WebBrowser to Navigate again to the same URI but with your custom user-agent specified.
    This is a good idea, thanks for sharing!

  8. #8
    Registered User
    Join Date
    Aug 2014
    Posts
    1

    Re: Changing the phone:WebBrowser control useragent programatically

    Quote Originally Posted by r2d2rigo View Post
    I did it for my app Agent Browser. You have to add a new callback to the Navigating event of your WebBrowser and inside it check if it is the first call of the function; if yes, tell the WebBrowser to Navigate again to the same URI but with your custom user-agent specified.
    I have a problem similar to this. (an extension to this problem). When I click submit on a page, it posts some data and take me to new page. If I intercept the call and inject user agaent, then the Post Data is lost.

    How to get the post data while navigating so that I can resend the request with the data and User Agent.

Similar Threads

  1. changing the writing language programatically
    By the_king2008 in forum Symbian
    Replies: 4
    Last Post: 2009-10-19, 15:24
  2. programatically control incoming & outgoing calls?
    By mysilversir in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 5
    Last Post: 2009-02-07, 13:57
  3. Changing buttons of a dialog programatically
    By juannoguera in forum Symbian
    Replies: 0
    Last Post: 2008-12-16, 22:21
  4. Replies: 3
    Last Post: 2006-09-12, 20:10
  5. Changing ringtones by changing profile programatically
    By daredevilWin in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-05-24, 07:59

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×