Welcome Guest Search | Active Topics | Sign In | Register

WebBrowser WinForm set page language Options
asterd
Posted: Wednesday, February 5, 2014 10:39:42 AM
Rank: Member
Groups: Member

Joined: 12/3/2013
Posts: 16
Good Evening,

i have to force the language of the page on a WebBrowser in WinForm.
The page that i display use the default browser language as the page language so it load the page in english.
How can i force the WebView to set a different browser language?

Thank you!
eo_support
Posted: Thursday, February 6, 2014 9:45:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You can handle WebView.BeforeRequestLoad and then set the "Accept-Language" header. For example:

Code: C#
//Handle BeforeRequestLoad event
WebView1.BeforeRequestLoad += new BeforeRequestLoadHandler(WebView_BeforeRequestLoad);

//BeforeRequestLoad handler
void WebView_BeforeRequestLoad(object sender, BeforeRequestLoadEventArgs e)
{
    //Set Accept-Langauge to german
    e.Request.Headers["Accept-Language"] = "de-DE";
}


Hope this helps.

Thanks!

asterd
Posted: Friday, February 7, 2014 2:39:04 AM
Rank: Member
Groups: Member

Joined: 12/3/2013
Posts: 16
Thank you!!
eo_support
Posted: Friday, February 7, 2014 9:11:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
You are welcome. Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.