C#, WPF

HTML 5 Content in WPF Browser Control

WPF Browser control used to browse HTML pages. Even your machine has latest version than IE 7 WPF normally used IE 7 to render HTML and unfortunately IE 7 does not support for HTML 5. But if we need to render HTML 5 content inside Browser control, what can we do?
There are two solutions for this.

1) Change Registry to use IE 9 or your latest IE version in WPF Browser control.
2) Add Meta tag to web page which IE version should used to render.

1) Change Registry to use IE 9 or your latest IE version in WPF Browser control

Open Registry Editor (By Using “Start” -> “Run” -> “REGEDIT” hit “Enter” Key)
Go to :
HKEY_LOCAL_MACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main -> FeatureControl -> FEATURE_BROWSER_EMULATION

RegPath

Right click on empty space and “New” -> “DWORD (32 bit) Value”. This will add new entry, then type your application exe name.

RegAdd

Right click on new record and select “Modify”. Add your latest browser version. E.g. For IE 9 it is 270f.

RegChange

You can find full list from this link.

2) Add Meta tag to web page IE version should used to render.

Add the “X-UA-Compatible” meta tag inside the head tag before any links to CSS, JavaScript files of your HTML page.

<meta http-equiv="X-UA-Compatible" content=" IE=edge " >

or

<meta http-equiv="X-UA-Compatible" content="IE=9" >

By adding “IE=edge” will use latest installed IE version or we can add browser version directly.

One thought on “HTML 5 Content in WPF Browser Control

Leave a comment