Question

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 " })
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top