语言

Menu
Sites
Language
How to modify webpage content

I am designing a native app which could display webpage on ewk_view with few modifications.
I'm able to set url of ewk_view successfully with ewk_view_url_set function successfully.

Now I want to read page source in a String.
I'm having very hard time getting contents(Page source) set on current window of WebView.
The next step will be that I will be modifying the page and again display it in the same view...

Please help me...
Thanks in advance.

响应

4 回复
Armaan-Ul- Islam

As far as I have seen EFL WebKit (EWK) doesn't provide direct page source code. I can share an idea with you to use 'view-source:' while seeting the URL for the webview. Example:

URL:'view-source:https://www.google.com'

The Evas_Object would load the source code now.

ewk_view_url_set( yourEvas_Object,'view-source:https://www.google.com');

Now try editing the source as desired & load. You can use ewk_view_html_string_load() or any other manner you preffer.

ewk_view_html_string_load( yourEvas_Object, editedHTMLString);     

ewk_view_html_string_load() reference: https://developer.tizen.org/dev-guide/latest/org.tizen.native.mobile.apireference/group__WEBVIEW.html#ga17be29102c6deb5d4c902145bcae0ad2

Hope it helps, Thank you.

If found helpful Please mark it as the Best Answer to promote & help others to solve similar issues.

Vikram Dattu

Hi Armaan,

Thanks for the quick reply.

I understand that ewk_view_html_string_load() function lets me set new

editedHTMLString

as a source code.

But I think you skipped something...

How do I get that content in a string at first place?

 

And, won't this below piece of code code display source code in WebView???

ewk_view_url_set( yourEvas_Object,'view-source:https://www.google.com');

Which is very bad to display to user...

And it makes me sad that

[quote] EFL WebKit (EWK) doesn't provide direct page source code [/quote]

 

I need some proper workaround...

Please share some valid/usefull way you know for doing so!

 

I mean there should be some way to get html source of a loaded Webpage from Web view.

 

Thanks

Vikram Dattu

Hi Armaan,

Thanks for the quick reply.

I understand that ewk_view_html_string_load() function lets me set new

editedHTMLString

as a source code.

But I think you skipped something...

How do I get that content in a string at first place?

 

And, won't this below piece of code code display source code in WebView???

ewk_view_url_set( yourEvas_Object,'view-source:https://www.google.com');

Which is very bad to display to user...

And it makes me sad that

[quote] EFL WebKit (EWK) doesn't provide direct page source code [/quote]

 

I need some proper workaround...

Please share some valid/usefull way you know for doing so!

 

I mean there should be some way to get html source of a loaded Webpage from Web view.

 

Thanks

 

 

 

Vikram Dattu

Does anyone know how to get WebPage source in a string?

My whole project is stuck with the same.