Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Loading css / js files from html file WKWebView on Xamarin Forms

AbesoddyAbesoddy Member ✭✭

Hello everyone,

Since few days i have a problem with WKWebView on Xamarin forms...

Before updated Xamarin Forms, i had a WebView (pathologie_1.html) on the page MainPage.xaml with custom renderer iOS. But the WebViewRenderer is obselete, so i changed this to WkWebViewRenderer.

But for now, all the links (style.css, app.js) includes in my html file (pathologie_1.html) are not loaded... I replace their links with javascript fonction (EvaluateJavascript).

The path of assets files is : /var/mobile/Containers/Data/Application/CD3CE15C-478A-4CA5-BA01-A07C91A72166/Library/1/ressources/ressources/view.css
The path of html file is : /var/mobile/Containers/Data/Application/CD3CE15C-478A-4CA5-BA01-A07C91A72166/Library/1/ressources/pathologies/pathologie_1.html

I have tested many solutions but i can't find...

Thanks for your answers !!

Posts

  • AbesoddyAbesoddy Member ✭✭

    Here is the link of the depository : github.com/Abesoddy/WkWebviewSample.

    The application contains a zip file (ressources.zip) which is unzipped the first time the application is launched. An open webview button is present on the home page. This opens a new page with the webview which will look for an html file in local storage then must replace the links of the css files in this html page. But it does not work...

Sign In or Register to comment.