ActionLink How to open new windows without toolbar and menue with specific size?

5.5k views Asked by At

Hi I cannot figure out how to open a new plain browser window without any browser controls and with specific dimensions. I tried the following but it doesn't work, more accurately it still opens a regular browser window with controls.

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

There are 1 answers

0
webMac On BEST ANSWER

I'd say you have to use JavaScript in order to do so:

<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>
<a href='javascript:openInNewWindowWithSettings();'>Link that opens in new window</a>

Then do a

return Redirect(_linkToYourUrl);

in your MVC Controller.

Or just insert the Url in the HTML Link above.