Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to load HtmlWebViewSource() with External base webUrl(http://myDomain) in xamatin.forms ios?

$
0
0

I am in need to load a webview HTML string which is saved in HtmlWebViewSource() with an external url. i.e. my css/js/and other files are not stored locally, I have to load them dynamically from a web url.
Following Xamarin.forms common code is working fine for android i.e. all the css/js files and links are loaded successfully with the base url:
WebView browser = new WebView();
var htmlSource = new HtmlWebViewSource();
var ResultHTML = reponse.Content.ReadAsStreamAsync().Result;
var streamReader = new StreamReader(ResultHTML);
htmlSource.Html = streamReader.ReadToEnd();
htmlSource.BaseUrl = http://myDomain.com;
browser.Source = htmlSource;

But in ios the HTML response is loaded without the css/js files. Means the base url is not working properly for ios. In console I have printed the path and it is showing:
file:///var/containers/Bundle/Application/3B2F2AEA-15E8-44BE-B585-20D9CCE2C706/Party_Staff.iOS.app/ http://myDomain.com/css/isolutions.css.
I Want to replace this default path(file:///var/containers/Bundle/Application/3B2F2AEA-15E8-44BE-B585-20D9CCE2C706/Party_Staff.iOS.app/ ) with my external url.

I have searched a lot but found nothing helpful. Everyone is suggesting to save each files locally in the resource folder of ios and to use dependency service for base url but I requirement is to load files from external url. Please help me regarding this issue for ios.

Some lines of my HTML response is:



Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>