问题
I'm trying to make asp.net mvc application to be shown in c# webbrowser component. Everything works fine except file downloading. In this mvc application there is a lot of side components, so there was found no other way to handle downloadFileLink but to use following JS:
function downloadButtonClick(s, e, buttonID, actionUrl) {
var downloadUrl = actionUrl + '?FileID=' + s.GetRowKey(e.visibleIndex);
if (e.buttonID == buttonID) {
window.location = downloadUrl;
}
}
this approach works fine while I'm trying to download file by this link using any browser, except webbrowser component.
It seems to ignore all window.location manipulations(I've tried window.location.href = downloadUrl and window.location.replace(downloadUrl))
Can anyone give a reason to this behavior?
回答1:
In case your web page doesn't work properly in WebBrowser control, but does well in the full Internet Explorer browser, consider implementing Feature Control.
来源:https://stackoverflow.com/questions/18356537/c-sharp-webbrowser-component-ignores-window-location-href-url