Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

html code on the selected url

Post Reply
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

html code on the selected url

Post by pushca »

hi! can I upload my html code to the specified url? In the temple, I achieved this in this way:
Form1.Chromium1.Browser.MainFrame.LoadString('<HTML>', 'https://musite.com');

I tried to do WVBrowser1.NavigateToString(str); but it loads the page on about:blank
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: html code on the selected url

Post by salvadordf »

The WebView2 API only allows you to call TWVBrowserBase.NavigateToString with one parameter for the HTML contents.

https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.1185.39#navigatetostring
Initiates a navigation to htmlContent as source HTML of a new document.

public HRESULT NavigateToString(LPCWSTR htmlContent)

The htmlContent parameter may not be larger than 2 MB (2 * 1024 * 1024 bytes) in total size. The origin of the new page is about:blank.
WebView2 doesn't allow you to specify the origin URL in this case.
Post Reply