Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

WebView.ViewSource does not work for HTML Options
PS
Posted: Wednesday, May 8, 2019 10:32:42 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 83
Whenever we call WebView.ViewSource it only works when the content has been loaded via an url, if the content is loaded via html it does not work. An empty line is returned instead.
eo_support
Posted: Wednesday, May 8, 2019 3:56:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,434
Hi,

There is no such thing as "view source" for non-Url request. For performance reasons, Chromium browser engine NEVER keeps the whole HTML source when it loads a page. The source HTML contents comes in pieces through the network and the browser engine parse the pieces as it goes. Once the part is parsed, the original contents received from the network is discarded.

When you call "View Source" (or right click the page and then select "View Page Source" from the context menu in Google Chrome browser), the browser engine in fact would re-load the same request. However this time the HTML parser would not kick in and the HTML page is displayed directly as is.

Because there is no Url to reload, "View Source" would not work for contents through Loadhtml. The closest you can get is this method:

https://www.essentialobjects.com/doc/eo.webbrowser.webview.gethtml.aspx

However this will get the current HTML. So for example, if the source HTML contains JavaScript code that dynamically generates additional contents, then GetHtml would see such additional contents. However the true "view source" feature (if it works for LoadHtml) would not see such content.

Hope this make senses to you.

Thanks!
PS
Posted: Monday, May 13, 2019 5:33:20 AM
Rank: Advanced Member
Groups: Member

Joined: 10/24/2018
Posts: 83
Thank you for your reply!
We have decided to drop our "view source" feature as the Debug UI / DevTools provide much better functionality anyway.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.