简体   繁体   中英

how to open link in a new window and set size after page load?

I have a link with querystring like "...com/default3.aspx?id=123?code=456" This link create automatically and sending in mail as a hyperlink. I design default3.aspx page and doing some operations according to querystring. Is that a way open this link in a new window and set window size, after clicked from mail this link?

I tried this but it doesn't work.

<body onload="resizeWindow()" >
...
    <script type="text/javascript">
    function resizeWindow() 
   {           
    // you can get height and width from serverside as well      
    var width=100;
    var height=100; 
    window.resizeTo(width,height);           
    }
    </script>

Thank you.

Try to open window using window.open like window.open("", "", "width=200, height=100");

Check out sample code at W3Schools http://www.w3schools.com/jsref/met_win_open.asp

Check for demo using Try it yourself

I think You should use this javascript function as i have used the same code in many of my webforms and it is also tested.

window.open('Redirecturl.aspx','Graph','height=600,width=800,resizable=yes');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM