WebView::GetPageSource() returns original HTML

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Palloy
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Oct 11, 2017 3:16 am

WebView::GetPageSource() returns original HTML

Post by Palloy »

wxPHP wrapping wxWidgets 3.0.0.2

WebView control instantiated OK,
LoadURL() sucessfully completed OK,
edited the rendered HTML with Cut()/Copy()/Paste()/DeleteSelection() OK,
then
GetPageSource() gives me the original HTML source, not the edited HTML source
GetPageText() gives me the original HTML's text, not the edited HTML's text

So how do you get the edited HTML's source or text?
What is the point in being able to edit the HTML if you can't get hold of the new result?
Palloy
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Oct 11, 2017 3:16 am

Re: WebView::GetPageSource() returns original HTML

Post by Palloy »

Can anyone just confirm that GetPageSource() returns the HTML of the currently loaded URL and NOT the currently displayed page (as edited)?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WebView::GetPageSource() returns original HTML

Post by doublemax »

I haven't tried it myself, but it sounds normal to me if you only get the original HTML back. I'm more surprised that things like Cut/Paste/Deleteselection work at all.

Have you tried SetEditable()?
Use the source, Luke!
Palloy
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Oct 11, 2017 3:16 am

Re: WebView::GetPageSource() returns original HTML

Post by Palloy »

I have the control SetEditable() - it didn't work without it.
After each edit I use GetPageText() to see what effect that has had on the source HTML, and there is none, although the webView changes as expected.
Without a way to get at the edited source, editing seems pointless
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: WebView::GetPageSource() returns original HTML

Post by PB »

FWIW, I did a simple test:
1. I launched the webview sample and loaded http://www.example.com page.
2. I checked that both source and text of the page match the page content (using sample menu commands View Source and View Text)
3. I checked Edit Mode in Menu/Edit, selected the "white box" with the title and paragraph, and <Del>eted it.
4. I pasted a random text I copied from MSVC build log.
5. I checked the source and text the same way as in #2 and both actually reflected the changes I had made.

If you do the same, do you get the same result?

You did not state which platform and therefore which wxWebView backend you use. I ran the test with wxWidgets 3.1.1 32-bit, IE11 on Win10 64-bit, nothing set for webview.exe in FEATURE_BROWSER_EMULATION.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WebView::GetPageSource() returns original HTML

Post by doublemax »

@OP: Did you manually edit the page or just programmatically using Cut()/Copy()/Paste()/DeleteSelection() ?
Use the source, Luke!
Post Reply