Languages

Menu
Sites
Language
WebView resource requests

Is there a way to capture/handle the WebView resource requests ?
I am looking to something similar to  shouldInterceptRequest in Android.

Thanks
Manos

Responses

4 Replies
Jean Yang

Hi, 

I have met same issue with you, it seems there is no web resource get API currently, there are some call back for url change, page load...

But there is an alternative way, you can use the curl to get the web content. 

 

Alex Dem

Hi,
just fyi, regarding curl http://curl.haxx.se/libcurl/c/ 
Regarding WebView api: https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__WEBVIEW.html
and WebView tutorial:
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/web/web_tutorials_n.htm
Alexey.

Manos Theocharopoulos

So I guess the answer is no on the WebView API to get the resource requests.

Jean Yang

Seems like that, as I know, in 2.2.1 there is a way to get the resourse, but in 2.3.0 I didn't find related API.

 

WEB CONTROLS
 
In the 2.2.1 API, the Tizen::Web::Controls::Web namespace was used.
 
In the 2.3 API, the WebView module provides those functionalities.

INITIALIZING THE WEB CONTROL INSTANCE
 
In 2.2.1 API, it was done this way: 
1.Create the Tizen::Web::Controls::Web *__pWeb object.
2.Set the shape with the __pWeb->Construct() function.
3.Add the control to a window with the form->AddControl(__pWeb) function.
 
Initializing in 2.3 is vastly different. A very brief outline is below. For more information, see the tutorial.
 1.Basic structure (example):
typedef struct _Browser_Window

   Evas_Object *elm_window; 
   Evas_Object *ewk_view; 
}
Browser_Window

Browser_Window *window;  2.Create the window with the elm_win_add() function.
3.Set window geometry callbacks (window_geometry_get and window_geometry_set) for the window's smart class.
4.Use the evas_object_geometry_get(), evas_object_move(), and evas_object_resize() functions to react to events:
static Ewk_View_Smart_Class *miniBrowserViewSmartClass() 

   static Ewk_View_Smart_Class ewkViewClass = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("MiniBrowser_View"); 

   return &ewkViewClass; 

ewk_view_smart_class_set(miniBrowserViewSmartClass());

// Callback headers
// static Eina_Bool on_window_geometry_get(Ewk_View_Smart_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *width, Evas_Coord *height);
// static Eina_Bool on_window_geometry_set(Ewk_View_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height);

Ewk_View_Smart_Class *ewkViewClass = miniBrowserViewSmartClass();
ewkViewClass->window_geometry_get = on_window_geometry_get;
ewkViewClass->window_geometry_set = on_window_geometry_set; 
LOADING A WEB PAGE
 
The 2.2.1 API used the __pWeb->LoadUrl(url) function, while the 2.3 API uses the ewk_view_url_set() function