я бы протестировал Cefsharp, но не вижу, где установить --allow-file-access-from-files
я пытался
<Window x:Class = "Chromium.MainWindow"
xmlns:cef = "clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d = "http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local = "clr-namespace:Chromium"
mc:Ignorable = "d"
Title = "MainWindow" Height = "450" Width = "800">
<Grid>
<cef:ChromiumWebBrowser x:Name = "browser" IsBrowserInitializedChanged = "browser_IsBrowserInitializedChanged"></cef:ChromiumWebBrowser>
</Grid>
</Window>
private void browser_IsBrowserInitializedChanged(object sender, DependencyPropertyChangedEventArgs e)
{
browser.LoadUrl("file:///C:/index.html");
}
но это бесполезно .. есть ли решение принять локальный файл?
внутри локального файла index.html я загружаю локальный файл json (json в той же папке, что и index.html) с помощью d3.son() (библиотека d3.js)
<script src = "https://d3js.org/d3.v4.min.js"></script>
<script>
:
:
var link = svg.append("g").selectAll(".link"),
node = svg.append("g").selectAll(".node");
d3.json("flare.json", function (error, classes) {
:
Отображаемая ошибка: «Доступ к XMLHttpRequest в файле: ///C:/flare.json из источника «null» заблокирован политикой CORS: запросы между источниками поддерживаются только для схем протоколов: http, data, chrome-extension, chrome, https, chrome-untrusted.", источник: файл:///C:/index.html (0)
у меня нет проблем с вызовом из Process.Start:
var p = System.Diagnostics.Process.Start("chrome.exe", "\"file:///C:/index.html\" --allow-file-access-from-files");
@amaitland, мой английский не очень хорош, но теперь я понял, как инициализировать настройки...





На самом деле это легко:
просто сделайте это в конструкторе:
var settings = new CefSettings();
settings.CefCommandLineArgs.Add("allow-file-access-from-files");
settings.CefCommandLineArgs.Add("allow-universal-access-from-files");
Cef.Initialize(settings);
См. github.com/cefsharp/CefSharp.MinimalExample/blob/master/… общий пример