【问题标题】:ActionLink How to open new windows without toolbar and menue with specific size?ActionLink 如何打开没有特定大小的工具栏和菜单的新窗口?
【发布时间】:2013-09-04 16:02:06
【问题描述】:

您好,我不知道如何在没有任何浏览器控件和特定尺寸的情况下打开一个新的普通浏览器窗口。我尝试了以下方法,但它不起作用,更准确地说,它仍然会打开一个带有控件的常规浏览器窗口。

@Html.ActionLink("New Window", "Index", new {Controller="controller"}, new { target= "_blank, toolbar=0, location=0, menubar=0 " })

【问题讨论】:

标签: asp.net-mvc asp.net-mvc-4 actionlink new-window


【解决方案1】:

我想说你必须使用 JavaScript 才能这样做:

<script>
    function openInNewWindowWithSettings()
    {
        window.open('@Url.Content("~/YourController/YourPage")',target = '_blank', width = '1000px', height = '800px');
                              //options:
                                //fullscreen = 'yes',
                                //height = '800px',
                                //left = '20px',
                                //location = 'no', //address field 
                                //menubar = 'no',
                                //resizeable = 'yes',
                                //scrollbars = 'yes',
                                //status = 'yes', //status bar
                                //titlebar = 'yes',
                                //toolbar = 'yes',
                                //top = '20px', 
                                //width = '1000px'

    }
</script>
&lt;a href='javascript:openInNewWindowWithSettings();'&gt;Link that opens in new window&lt;/a&gt;

然后做一个

return Redirect(_linkToYourUrl);

在您的 MVC 控制器中。

或者只是在上面的 HTML 链接中插入 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-05
    • 2011-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多