pavanbehere / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Disabling images and flash #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello there,

This might not be an issue of the current openwebkitsharp
How can I implement the openwebkitsharp to disable any images or flash in my VB 
browser ?

I am looking forward to hearing from you :)

Original issue reported on code.google.com by dothebe...@gmail.com on 20 Mar 2012 at 10:48

GoogleCodeExporter commented 8 years ago
You must subscribe to an event of <webkitbrowser>.ResourceIntercepter. You must 
add a handler to ResourceSendRequest and inside the code: if 
e.Resource.MimeType.Contains("image") or e.Resource.MimeType.Contains("flash") 
then
e.SendRequest = false : end if

Original comment by tsumalis96@gmail.com on 21 Mar 2012 at 3:05

GoogleCodeExporter commented 8 years ago
Hi Tsumali,

The code says that 
'ResourceIntercepter' is not an event of 'WebKit.WebKitBrowser'
'Resource' is not a member of 'WebKit.WebKitResourceRequestEventArgs'
'Resource' is not a member of 'WebKit.WebKitResourceRequestEventArgs'

''' The last two are in the "Private Sub ResourceSendRequest" below

This is my code:

Dim Browser As New WebKit.WebKitBrowser
AddHandler Browser.ResourceIntercepter, AddressOf ResourceSendRequest

    Private Sub ResourceSendRequest(ByVal sender As Object, ByVal e As WebKit.WebKitResourceRequestEventArgs)
        If e.Resource.MimeType.Contains("image") Or e.Resource.MimeType.Contains("flash") Then
            Debug.Text = Debug.Text + " " + e.ResourceUrl
            e.SendRequest = False
        End If
    End Sub

Is there something that I miss?

Original comment by dothebe...@gmail.com on 22 Mar 2012 at 7:19

GoogleCodeExporter commented 8 years ago
You must add a handler to Browser.ResourceIntercepter.ResourceSendRequest, 
Browser.ResourceIntercepter is not an event

Original comment by tsumalis96@gmail.com on 23 Mar 2012 at 1:24

GoogleCodeExporter commented 8 years ago
Hi tsumali,

Yes it works great now.
Thank you

Original comment by dothebe...@gmail.com on 23 Mar 2012 at 9:50