Erkan
Erkan

Reputation: 35

Windows Phone 8.1 webview not loading local files

I am using webview in my project. And i want to load some css,js files from local(forexample jquery or bootstrap files, or custom..)

Anyway,

This is my folders in solution explorer

And this code is what i am using for sample..

   private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
    {

        webViewFormResponse.NavigateToString(" " +
            "<html><head><link rel='stylesheet' href='ms-appx-web:///css/mobileview.css' type='text/css' media='screen' /></head>" +
         "<input type='text' value='testt'>" +
 "</html>");

 }

I am using ms-appx-web:///, But css not loading. What is my wrong?

Upvotes: 1

Views: 600

Answers (1)

Matt Small
Matt Small

Reputation: 2275

You can't use NavigateToString in this way. You will have to use WebView.NavigateToLocalStreamUri to load local CSS. Please see my blog post for some good information on this:

http://blogs.msdn.com/b/wsdevsol/archive/2014/06/20/a-primer-on-webview-navigatetolocalstreamuri.aspx

Upvotes: 1

Related Questions