C# WebBrowser component ignores window.location.href = url

我只是一个虾纸丫 提交于 2019-12-22 13:58:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!