Welcome Guest Search | Active Topics | Sign In | Register

LoadHtml sets CanGoBack to true Options
Michael
Posted: Wednesday, September 2, 2015 9:14:49 AM
Rank: Member
Groups: Member

Joined: 6/16/2014
Posts: 25
Hi,
In my code I create a new WebView and immediately load HTML Code into the Webview with LoadHtml(). It seems that this causes CanGoBack to be 'true'. If I load a url as the first content, CanGoBack keeps the value 'false'. If I go back after LoadHtml, the new url is a empty string.

regards,
Michael
eo_support
Posted: Monday, September 7, 2015 8:11:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

This is due to the fact that the web engine must first be initialized with a Url. LoadHtml is somehow similar to setting body.outerHTML, so it won't function without first having a body element first. Because of this, internally the WebView will always call LoadUrl("about:blank") first. If you issue another LoadUrl immediately, then the initial LoadUrl("about:blank") call is canceled thus your Url became the first entry in the history. However if you call LoadHtml, then it must first wait the initial LoadUrl("about:blank") to finish. This causes "about:blank" to be the first entry in the history. If this is an issue, you can do:

1. Manage the history yourself. This way you will have full control over what appears in the history;

-- OR --

2. Use Data Url. You can encode the whole HTML as a data Url and then pass that data Url to LoadUrl. You can use this method to load small HTML snippet since there might be length limits on the Url;

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Michael
Posted: Tuesday, September 8, 2015 6:56:03 AM
Rank: Member
Groups: Member

Joined: 6/16/2014
Posts: 25
Hi,
thank you for the tip with the data url. This works well!

Beside this, how can I manage the history myself?

Best regards,
Michael

eo_support
Posted: Tuesday, September 8, 2015 7:59:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

By managing history yourself, I meant you would keep a list of history items in your own code, then instead of using GoBack/CanGoBack, you can check your own history item and call LoadUrl instead.

Thanks!
Michael
Posted: Tuesday, September 8, 2015 8:36:10 AM
Rank: Member
Groups: Member

Joined: 6/16/2014
Posts: 25
Ok.
It seems that the youtube fullscreen is still not working. Is there any chance, that this will work in the near future?
eo_support
Posted: Tuesday, September 8, 2015 8:39:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

That is not supported yet. It probably will not be added in the near future, but I am hoping that it to be added this year.

Thanks!


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.