I have created a program in .NET to edit HTML code and view it in realtime, and it work pretty good, but there's a problem: since i used the WebBrowser control it doesn't work with new CSS, for example, if i try border-radius it doesen't work.
I already searched, and i found a way to solve it by editing a key in the regedit, but in this way it work only in my computer, and i need this program to run even on other computers where i don't have privilege to run the regedit.
I thougth about changing control, and i tried the webkit control, and the CSS3 seems to work, but there's a new problem.
I show the page by changing the HTML in real time on the richtextbox textchanged event, so the page isn't really loaded, and the external resource as images and other things doesen't work, in the WebBrowser i fixed the problem by searching all the img tags and changing their attribute, for example i changed "image.png" to "file:///C:\pathoftheHTMLfile\image.png".
That worked good in WebBrowser, but it doesn't work on WebKit... I really don't know what should i do...
I'm gonna trying Gecko Browser soon, but i would like to know if someone have some idea on:
- Is there some way to use CSS3 in WebBrowser without editing the system registry?
- Why changing the images does work in WebBrowser but not in Webkit Browser?
Thanks for the help i'm sure you will give me ^_^
UPDATE: I discovered that the change of the image happen correctly in the WebKitBrowser, the problem is that it seems to be able to load only image from internet, not local image, and it seems to be a known problem of the webkit control Opening local files in Webkit .NET
But noone answered to that question in a good way...
UPDATE 2: I tryed doing as Noseratio said in the comments (my code is this)
Private Sub SetBrowserEmulationMode()
Dim appName As String = System.IO.Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)
Using key = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", RegistryKeyPermissionCheck.ReadWriteSubTree)
key.SetValue(appName, getBrowserEmulationMode, RegistryValueKind.DWord)
End Using
End Sub
Private Function getBrowserEmulationMode() As UInt32
Dim browserVersion As Integer = 7
Using ieKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Internet Explorer", RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.QueryValues)
Dim version = ieKey.GetValue("svcVersion")
If version Is Nothing Then
version = ieKey.GetValue("Version")
If version Is Nothing Then
Throw New ApplicationException("Microsoft Internet Explorer is required!")
End If
End If
Integer.TryParse(version.ToString().Split("."c)(0), browserVersion)
End Using
Dim mode As UInt32 = 10000
Select Case browserVersion
Case 7
mode = 7000
Exit Select
Case 8
mode = 8000
Exit Select
Case 9
mode = 9000
Exit Select
End Select
Return mode
End Function
But... even if the key is correctly created, nothing change. I'm trying it with a simple page like:
<html>
<head>
<style>
div{border:1px solid black; height:200px;border-radius:10px;}
</style>
</head>
<body>
<div>
</div>
</body>
</html>
But the border is not rounded, even if while i save it and open with IE it's correctly rounded
UPDATE 3: It already worked at update2, i'm a stupid XD