Skip to content

How to get HTTP status codes from WebKitWebView? #558

Closed Answered by gustavqmatic
gustavqmatic asked this question in Q&A
Discussion options

You must be logged in to vote

I never found this info in the webkit api so added it myself. In anyone else wants this this is what I changed:

in webkit, in file Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp I added:

const guint webkit_web_view_get_status_code(WebKitWebView* webView)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
    if (auto* response = webkit_web_resource_get_response(webView->priv->mainResource.get())) {
            return webkit_uri_response_get_status_code(response);
    }
    return 0;
}

Also added this function in header file Source/WebKit/UIProcess/API/glib/WebKitWebView.h

I could then use it from cog_handle_web_view_load_changed, it seems to work only in state WEBKIT_LOAD_CO…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gustavqmatic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant