我正在尝试在MVC4中使用javascript打开一个新窗口(window.open)。这是我当前的代码:
                var url = '@Url.Action("Index", "ReportExecution", new {target="_blank"})';
            window.location.href = url;这不会打开一个新窗口。它将url设置为"ReportExecution/Index?target=_blank“。我尝试使用:
window.open而不是
window.location.href但这并不管用。如何才能做到这一点?
发布于 2015-12-08 01:01:01
好的,这段代码可以在javascript中打开一个新的MVC4视图:
window.open('@Url.Action("Index", "ReportExecution")');发布于 2015-12-08 01:30:32
您的代码看起来很好,但是new {target="_blank"})是多余的。
<script type="text/javascript">
   var url = '@Url.Action("Index", "ReportExecution")';
   window.open(url, '_blank');
</script>https://stackoverflow.com/questions/34138915
复制相似问题