html - Windows UWP Webview with Local Relative URLs -


i developing application uses webview primary interface. upon startup, program loads page included in content directory of project, complete external style sheets , scripts , load properly. code load is:

webviewer.navigate(new uri("ms-appx-web:///content\\landing.html")); 

and content of landing.html follows. works properly.

<!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head>     <meta charset="utf-8" />     <base href="ms-appx-web://58377ramsays.studios.chordwriter/content/" />     <link rel="stylesheet" type="text/css" href="css/main.css" />     <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />     <title></title> </head> <body>     ... </body> </html> 

a problem has arisen when try use navigatetostring() load rendered content viewer , try use these style sheets, , fontawesome. loading file using code:

webviewer.navigatetostring(song.renderhtml(appsettings)); 

and renderhtml() function looks partially this:

string content = @"<doctype html> <html>   <head>     <base href=""ms-appx-web://58377ramsays.studios.chordwriter/content/"" />     <link rel=""stylesheet"" type=""text/css"" href=""css/font-awesome.min.css"" />     <style type=""text/css"">       body { font-family: tahoma, geneva, sans-serif;         margin: 15px;         font-size: " + settings.values["settingsfontsize"] +  @"pt; }       span.flat { margin: -4px -2px;         font-family: 'lucida sans unicode','lucida grande',sans-serif;         font-size: 1.2em;         height: 0.9em;         display: inline-block; }       h3 { font-size: 1.5em; }       th { text-decoration: none;         font-weight: bold;         color: #127690; }       td { text-decoration: none;         font-weight: normal;         color: #000; }       { color: #000;         width: 1em; }     </style>   </head>     <body>"; // rest of rendering function. 

however cannot seem fontawesome load properly. far can tell font-awesome.min.css loading properly, because icons' i tags right size (square blocks) blank, meaning font file not being loaded. tried using <base> tag not seem work. there way make work?

edit: edited stylesheet , hardcoded full url of font file it, , still doesn't work.

it seems may need use buildlocalstreamuri / navigatetolocalstreamuri. in case, string-passed html can't refer contents of css folder. need build 'stream' contains string, css, or other external files. following api reference:

buildlocalstreamuri

you may need refere sample also. it's complicated use.

xaml webview control sample


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -