简体   繁体   中英

Webview in universal windows App

I am using webview control in my universal windows 10 app to open any link like: Uri uri= new (" http://www.c-sharpcorner.com "); WebView1.Navigate(uri); Now I want to open MS Excel file in webview. I save my excel file as a .htm/.html format then now I want to open this .htm/.html page in webview but it is not open while when i try to open it in browser (Firefox/explorer)it open successfully. I copy same link and pass in WebView1.Navigate(//link//); but not open. How can i open this .htm/.html (excel file) in webview.

Thanks.

First you create a folder in your app setting, then you create your html file in that folder and finally you call you webview

string desiredfName = "test.html"; 

StorageFolder newFolder = await localFolder.CreateFolderAsync(desiredName, CreationCollisionOption.ReplaceExisting);

StorageFile file = await newFolder.CreateFileAsync(desiredfName,CreationCollisionOption.ReplaceExisting);

await FileIO.WriteTextAsync(file, ht);

string url = "ms-appdata:///local/news/test.html";
    mywebview.Navigate(new Uri(url));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM