|
if (Target is WebView2.Stream) { |
|
Args.Response := ICoreWebView2.Environment.CreateWebResourceResponse(Target, 200, "OK", "") |
|
return |
|
} |
In the compiled script, if you add resources to the RC section of the exe, the files will all be loaded with the WebView2.Stream type, and at that point the Router won't add the correct Content-Type for them, which will cause the page to not display properly.
Adding the corresponding Content-Type for the type you're using as below can solve the problem temporarily, but a uniform and reliable way to handle it is needed here.
if (Target is WebView2.Stream) {
Headers := ""
if(RegExMatch(Args.Request.Uri, "i)\.js$")) {
Headers .= "Content-Type: text/javascript;"
}
if(RegExMatch(Args.Request.Uri, "i)\.svg$")) {
Headers .= "Content-Type: image/svg+xml;"
}
Args.Response := ICoreWebView2.Environment.CreateWebResourceResponse(Target, 200, "OK", Headers)
return
}
WebViewToo/Lib/WebViewToo.ahk
Lines 687 to 690 in 53fc321
In the compiled script, if you add resources to the RC section of the exe, the files will all be loaded with the
WebView2.Streamtype, and at that point the Router won't add the correctContent-Typefor them, which will cause the page to not display properly.Adding the corresponding Content-Type for the type you're using as below can solve the problem temporarily, but a uniform and reliable way to handle it is needed here.